Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1025103 // SimpleBaseDrumFinder2 (based on segmenter, dev.)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9806L/66K).

sclass SimpleBaseDrumFinder2 {
  double windowSize = 10.0; // seconds
  int imageHeight = 10; // must be >= segmenter.gridSize
  transient ISegmenter segmenter;
  transient new L<float[]> buf;
  transient int bufSize;
  transient BWImage lastImage;
  transient L<IntRange> ranges;
  
  L<IntRange> addFrequencyImageBrightnesses(float[] l) {
    if (segmenter == null)
      segmenter = mandatorySegmenterFromAGIBlue("Find base drum #1");
      
    buf.add(l);
    bufSize += l(last(buf));
    if (bufSize < audio_estimatedFrequencyImageWidth(windowSize)) null;
    print("Have img! " + l(buf));
    float[] data = normalizeFloatArray(concatFloatArrays(buf));
    lastImage = bwImageFromColumnFloats(imageHeight, data);
    buf.clear(); bufSize = 0;
    ranges = map rectXRange(segmenter.get(toBufferedImage(lastImage)));
    print(n2(ranges, "base drum") + ": " + ranges);
    ret ranges;
  }
}

Author comment

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: 263 / 688
Version history: 10 change(s)
Referenced in: [show references]