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

18
LINES

< > BotCompany Repo | #1018740 // clipWAVFromMarkers

JavaX fragment (include)

static File clipWAVFromMarkers(File srcWAV, File destWAV) {
  ret clipWAVFromMarkers(srcWAV, audioFileFloatMarkers(srcWAV), destWAV);
}

static File clipWAVFromMarkers(File srcWAV, L<? extends Number> markers, File destWAV) {
  Clip clip = spectro_clipFromFile(srcWAV);
  L<Int> intMarkers = sorted(allToInt(markers));
  
  // odd number of markers => clip to end
  if (oddLength(intMarkers)) intMarkers.add(spectro_clipLength(clip));
  
  L<IntRange> parts = intsToIntRanges(intMarkers);
  if (empty(parts))
    deleteFile(destWAV);
  else
    spectro_intRangesToWAV(clip, parts, destWAV);
  ret destWAV;
}

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: #1018740
Snippet name: clipWAVFromMarkers
Eternal ID of this version: #1018740/9
Text MD5: 3d7cbf07b01c33f53809d79a6701c6be
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-28 00:27:01
Source code size: 624 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 359 / 406
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018776 - markerIntRangesForWAV