Download Jar. Uses 11806K of libraries. Click here for Pure Java version (11776L/83K).
!7 sclass MarkedImage { BWImage image; int start, end; } static L<MarkedImage> markedImages; p-exp { L<File> files = audioRecordingsWithSingleClip(); pnl(files); markedImages = map_printProgress(files, func(File f) -> MarkedImage { BWImage image = wavToFrequencyImage(f); L<IntRange> parts = markerIntRangesForWAV(f, image); ret nu(MarkedImage, +image, start := first(parts).start, end := first(parts).end); }); //showOriginalClips(); //showYAveraged(); showYAveragedOnDifferentBands(); } svoid showYAveragedOnDifferentBands { // Select a band, y-average, auto-contrast repeat with sleep 5 { int h = first(markedImages).image.getHeight(); double a = random()*0.9, b = a+0.1; final int y1 = iround(a*h), y2 = iround(b*h); print("Band: " + y1 + " to " + y2 + " of " + h); quickShowImage(mergeBWImagesVertically(map(markedImages, func(MarkedImage img) -> BWImage { BWImage bandImage = clipBWImage(img.image, 0, y1, img.image.getWidth(), y2-y1); ret markIntRangesOnTopOfBWImage( bwAutoContrast(squishBWImage(squishBWImage(bandImage, 1), 20)), ll(intRange(img.start, img.end))); }))); } } svoid showYAveraged { // Show y-averaged, auto-contrasted on whole image showImage(mergeBWImagesVertically(map(markedImages, func(MarkedImage img) -> BWImage { markIntRangesOnTopOfBWImage( bwAutoContrast(squishBWImage(squishBWImage(img.image, 1), 20)), ll(intRange(img.start, img.end))) }))); } svoid showOriginalClips { showImage(mergeBWImagesVertically(map(markedImages, func(MarkedImage img) -> BWImage { markIntRangesOnTopOfBWImage(img.image, ll(intRange(img.start, img.end))) }))); }
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: | #1018774 |
Snippet name: | Grow auto-clip algorithm for audio recordings Prelude 1 [OK] |
Eternal ID of this version: | #1018774/14 |
Text MD5: | 4ff422b3364a6b0f40e7043017e6532f |
Transpilation MD5: | 1504f4ca1956b1e46839617647802469 |
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 17:32:50 |
Source code size: | 1792 bytes / 57 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 446 / 1030 |
Version history: | 13 change(s) |
Referenced in: | [show references] |