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).

!7

replace MarkedImage with BWImageAndRange.
static L<MarkedImage> markedImages;

p-exp {
  L<File> files = audioRecordingsWithSingleClip();
  pnl(files);
  markedImages = map_printProgress(f audioFileToBWImageAndRange, files);
  
  showOriginalClips();
  findBestBand();
}

svoid findBestBand {
  final int h = first(markedImages).image.getHeight();
  final new Best<IntRange> best;
  final new AIStrategy_RandomWithVariation<IntRange> strategy;
  strategy.random = func -> IntRange { randomIntRange(1, 0, h) };
  strategy.vary = func(IntRange r) -> IntRange { varyIntRange(r, 5, 1, 0, h) };
  strategy.submit = func(final IntRange r) -> double {
    new Scorer scorer;
    for (MarkedImage img : markedImages)
      audio_scoreEntryPoints(scorer, img, audio_entryPointsUsingBand_v1(img.image, r));
    if (best.put(r, scorer!)) {
      print(scorer + " / Band: " + r + " of " + h);
      quickShowZoomedImage(mergeBWImagesVertically(map(markedImages,
        func(MarkedImage img) -> BWImage {
          new Var<BWImage> processedImage;
          L<Int> entryPoints = audio_entryPointsUsingBand_v1(img.image, r, +processedImage);
          ret markIntRangesOnTopOfBWImage(
            markIntRangesOnTopOfBWImage(squishBWImage(processedImage!, 20),
              intsToSize2Ranges(entryPoints), 5),
            ll(intRange(img.start, img.end)), 5);
        })));
    }
    ret scorer!;
  };
  thread { while licensed { strategy.go(); } }
}

svoid showOriginalClips {
  showImage(mergeBWImagesVertically(map renderBWImageAndRange(markedImages)));
}

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: 378 / 942
Version history: 7 change(s)
Referenced in: #1018810 - Distinguish Yes and No Spike [OK]
#1018845 - Grow auto-clip algorithm for audio recordings v4 [find best band for exit points, dev.]