Uses 911K of libraries. Click here for Pure Java version (9473L/51K).
!7 cmodule BaseDrumFinder > DynPrintLog { new SimpleBaseDrumFinder2 finder; double minBPM = 60, maxBPM = 200; start { dm_requireLiveAudioFFT(); dm_vmBus_onMessage_q newAudioFrequencyImage(voidfunc(virtual BWImage img) { float[] b = bwImageColumnBrightnesses_generic(img); L<IntRange> ranges = finder.addFrequencyImageBrightnesses(b); int[] gaps = intRangeStartGaps(ranges); if (empty(gaps)) ret; sort(gaps); MultiSet<Int> ms = intArrayAsTreeMultiSet(gaps); new Best<Int> best; for (int gap : keys(ms)) if (isBetween_double( audio_frequencyImage_pixelsToBPM(gap), minBPM, maxBPM)) best.put(gap, ms.get(gap-1)+ms.get(gap)+ms.get(gap+1)); Int gap = best!; if (gap == null) ret with print("no fitting gaps"); print(ms); double exactGap = weightedAverage_lit( gap-1, ms.get(gap-1), gap, ms.get(gap), gap+1, ms.get(gap+1)); double bpm = audio_frequencyImage_pixelsToBPM(exactGap); printVars_str(+gap, +exactGap, +bpm); }); } }
Began life as a copy of #1025085
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: | #1025099 |
Snippet name: | Live Base Drum Finder 2 [dev.] |
Eternal ID of this version: | #1025099/13 |
Text MD5: | 537e8e0ae2d9462254f637cac8dde6b7 |
Transpilation MD5: | 88eede4118556662059f5c5603d7df81 |
Author: | stefan |
Category: | javax / audio analysis |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-05 19:19:52 |
Source code size: | 1140 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 256 / 1285 |
Version history: | 12 change(s) |
Referenced in: | [show references] |