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

9
LINES

< > BotCompany Repo | #1032404 // extractMonoSamplesFromWAV

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3577L/20K).

// times are in seconds
static short[] extractMonoSamplesFromWAV(File/S wavFile, double startTime, double endTime) ctex {
  if (wavFile == null) null;
  temp WAVDecoder decoder = new(newFileInputStream(wavFile));
  long start = round(startTime*decoder.sampleRate);
  long end = round(endTime*decoder.sampleRate);
  decoder.skipSamples(start);
  ret decodeWAVToMonoSamples(decoder, end-start);
}

Author comment

Began life as a copy of #1019662

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032404
Snippet name: extractMonoSamplesFromWAV
Eternal ID of this version: #1032404/7
Text MD5: ec1fdf4902d1e7e23c176338bb581428
Transpilation MD5: 30c7c6d8dd3957738b77cf29a7d65bfc
Author: stefan
Category: javax / sound
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-03 01:26:58
Source code size: 402 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 93 / 151
Version history: 6 change(s)
Referenced in: [show references]