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

44
LINES

< > BotCompany Repo | #1018800 // Grow auto-clip algorithm for audio recordings v3 [find best band for entry points, OK]

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

Download Jar. Uses 11913K of libraries. Click here for Pure Java version (14559L/105K).

1  
!7
2  
3  
replace MarkedImage with BWImageAndRange.
4  
static L<MarkedImage> markedImages;
5  
6  
p-exp {
7  
  L<File> files = audioRecordingsWithSingleClip();
8  
  pnl(files);
9  
  markedImages = map_printProgress(f audioFileToBWImageAndRange, files);
10  
  
11  
  showOriginalClips();
12  
  findBestBand();
13  
}
14  
15  
svoid findBestBand {
16  
  final int h = first(markedImages).image.getHeight();
17  
  final new Best<IntRange> best;
18  
  final new AIStrategy_RandomWithVariation<IntRange> strategy;
19  
  strategy.random = func -> IntRange { randomIntRange(1, 0, h) };
20  
  strategy.vary = func(IntRange r) -> IntRange { varyIntRange(r, 5, 1, 0, h) };
21  
  strategy.submit = func(final IntRange r) -> double {
22  
    new Scorer scorer;
23  
    for (MarkedImage img : markedImages)
24  
      audio_scoreEntryPoints(scorer, img, audio_entryPointsUsingBand_v1(img.image, r));
25  
    if (best.put(r, scorer!)) {
26  
      print(scorer + " / Band: " + r + " of " + h);
27  
      quickShowZoomedImage(mergeBWImagesVertically(map(markedImages,
28  
        func(MarkedImage img) -> BWImage {
29  
          new Var<BWImage> processedImage;
30  
          L<Int> entryPoints = audio_entryPointsUsingBand_v1(img.image, r, +processedImage);
31  
          ret markIntRangesOnTopOfBWImage(
32  
            markIntRangesOnTopOfBWImage(squishBWImage(processedImage!, 20),
33  
              intsToSize2Ranges(entryPoints), 5),
34  
            ll(intRange(img.start, img.end)), 5);
35  
        })));
36  
    }
37  
    ret scorer!;
38  
  };
39  
  thread { while licensed { strategy.go(); } }
40  
}
41  
42  
svoid showOriginalClips {
43  
  showImage(mergeBWImagesVertically(map renderBWImageAndRange(markedImages)));
44  
}

Author comment

Began life as a copy of #1018782

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018800
Snippet name: Grow auto-clip algorithm for audio recordings v3 [find best band for entry points, OK]
Eternal ID of this version: #1018800/8
Text MD5: d0bdfd37e462c5e50f946d970c6104b2
Transpilation MD5: b56af9f566e306ae6c9a29ae4fb60a64
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-14 12:42:24
Source code size: 1593 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 377 / 941
Version history: 7 change(s)
Referenced in: [show references]