1 | sbool audioSplit1_debug = true; |
2 | static float audioSplit1_threshold = 0.025f; |
3 | |
4 | static L<IntRange> audioSplit1(BWImage img) { |
5 | ret audioSplit1(img, audioSplit1_threshold); |
6 | } |
7 | |
8 | static L<IntRange> audioSplit1(BWImage img, float threshold) { |
9 | int w = img.getWidth(); |
10 | float[] f = bwImageColumnBrightnesses(img); |
11 | |
12 | new L<IntRange> l; |
13 | int j = -1; |
14 | for (int i = 0; i < l(f); i++) |
15 | if (f[i] >= threshold) { // start / continue streak |
16 | if (j < 0) j = i; |
17 | } else { |
18 | if (j >= 0) { // end streak |
19 | l.add(intRange(j, i)); |
20 | j = -1; |
21 | } |
22 | } |
23 | if (j >= 0) |
24 | l.add(intRange(j, w)); |
25 | if (audioSplit1_debug) |
26 | print("audioSplit1: " + w + " => " + sfu(l)); |
27 | ret l; |
28 | } |
Began life as a copy of #1018616
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018617 |
Snippet name: | audioSplit1 [uses column average brightness, for frequency images] |
Eternal ID of this version: | #1018617/6 |
Text MD5: | fe26a20853784de2e7d6560eefeef9ce |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-08 01:07:21 |
Source code size: | 722 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 381 / 413 |
Version history: | 5 change(s) |
Referenced in: | [show references] |