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

18
LINES

< > BotCompany Repo | #1018740 // clipWAVFromMarkers

JavaX fragment (include)

1  
static File clipWAVFromMarkers(File srcWAV, File destWAV) {
2  
  ret clipWAVFromMarkers(srcWAV, audioFileFloatMarkers(srcWAV), destWAV);
3  
}
4  
5  
static File clipWAVFromMarkers(File srcWAV, L<? extends Number> markers, File destWAV) {
6  
  Clip clip = spectro_clipFromFile(srcWAV);
7  
  L<Int> intMarkers = sorted(allToInt(markers));
8  
  
9  
  // odd number of markers => clip to end
10  
  if (oddLength(intMarkers)) intMarkers.add(spectro_clipLength(clip));
11  
  
12  
  L<IntRange> parts = intsToIntRanges(intMarkers);
13  
  if (empty(parts))
14  
    deleteFile(destWAV);
15  
  else
16  
    spectro_intRangesToWAV(clip, parts, destWAV);
17  
  ret destWAV;
18  
}

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: 358 / 406
Version history: 8 change(s)
Referenced in: [show references]