Libraryless. Click here for Pure Java version (9806L/66K).
1 | sclass SimpleBaseDrumFinder2 { |
2 | double windowSize = 10.0; // seconds |
3 | int imageHeight = 10; // must be >= segmenter.gridSize |
4 | transient ISegmenter segmenter; |
5 | transient new L<float[]> buf; |
6 | transient int bufSize; |
7 | transient BWImage lastImage; |
8 | transient L<IntRange> ranges; |
9 | |
10 | L<IntRange> addFrequencyImageBrightnesses(float[] l) { |
11 | if (segmenter == null) |
12 | segmenter = mandatorySegmenterFromAGIBlue("Find base drum #1"); |
13 | |
14 | buf.add(l); |
15 | bufSize += l(last(buf)); |
16 | if (bufSize < audio_estimatedFrequencyImageWidth(windowSize)) null; |
17 | print("Have img! " + l(buf)); |
18 | float[] data = normalizeFloatArray(concatFloatArrays(buf)); |
19 | lastImage = bwImageFromColumnFloats(imageHeight, data); |
20 | buf.clear(); bufSize = 0; |
21 | ranges = map rectXRange(segmenter.get(toBufferedImage(lastImage))); |
22 | print(n2(ranges, "base drum") + ": " + ranges); |
23 | ret ranges; |
24 | } |
25 | } |
Began life as a copy of #1025083
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025103 |
Snippet name: | SimpleBaseDrumFinder2 (based on segmenter, dev.) |
Eternal ID of this version: | #1025103/11 |
Text MD5: | c64e091c8bf7f9db5176a298b1bb4ddd |
Transpilation MD5: | 9ab0f561d88548dc884e7a96756b7bd7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-05 23:52:26 |
Source code size: | 919 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 265 / 691 |
Version history: | 10 change(s) |
Referenced in: | [show references] |