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

41
LINES

< > BotCompany Repo | #1018782 // Grow auto-clip algorithm for audio recordings Prelude 2 [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 11806K of libraries. Click here for Pure Java version (11926L/85K).

1  
!7
2  
3  
replace MarkedImage with BWImageAndRange.
4  
5  
static L<MarkedImage> markedImages;
6  
7  
p-exp {
8  
  L<File> files = audioRecordingsWithSingleClip();
9  
  pnl(files);
10  
  markedImages = map_printProgress(f audioFileToBWImageAndRange, files);
11  
  
12  
  showOriginalClips();
13  
  showYAveragedOnDifferentBands();
14  
}
15  
16  
svoid showYAveragedOnDifferentBands {
17  
  // Select a band, y-average, auto-contrast
18  
  repeat with sleep 1 {
19  
    int h = first(markedImages).image.getHeight();
20  
    double a = random()*0.9, b = a+0.1;
21  
    final int y1 = iround(a*h), y2 = iround(b*h);
22  
    final new Scorer scorer;
23  
24  
    quickShowZoomedImage(mergeBWImagesVertically(map(markedImages,
25  
      func(MarkedImage img) -> BWImage {
26  
        new Var<BWImage> processedImage;
27  
        L<Int> entryPoints = audio_entryPointsUsingBand_v1(img.image, intRange(y1, y2), +processedImage);
28  
        audio_scoreEntryPoints(scorer, img, entryPoints);
29  
        ret markIntRangesOnTopOfBWImage(
30  
          markIntRangesOnTopOfBWImage(squishBWImage(processedImage!, 20),
31  
            intsToSize2Ranges(entryPoints), 5),
32  
          ll(intRange(img.start, img.end)), 5);
33  
      })));
34  
      
35  
    print(scorer + " / Band: " + y1 + " to " + y2 + " of " + h);
36  
  }
37  
}
38  
39  
svoid showOriginalClips {
40  
  showImage(mergeBWImagesVertically(map renderBWImageAndRange(markedImages)));
41  
}

Author comment

Began life as a copy of #1018774

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: #1018782
Snippet name: Grow auto-clip algorithm for audio recordings Prelude 2 [OK]
Eternal ID of this version: #1018782/22
Text MD5: 11e101abf0ae355e79cb0274bf77f392
Transpilation MD5: bb493684126b9629d663d5216be78434
Author: stefan
Category: javax / audio
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-13 19:43:14
Source code size: 1333 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 457 / 1058
Version history: 21 change(s)
Referenced in: [show references]