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

8
LINES

< > BotCompany Repo | #1018661 // lengthOfWAVInSeconds (0 if file doesn't exist)

JavaX fragment (include)

static double lengthOfWAVInSeconds(File wavFile) {
  if (!fileExists(wavFile)) ret 0;
  temp WAVDecoder decoder = new(fileInputStream(wavFile));
  short[] s = new short[1];
  int n = 0;
  while (decoder.readMonoSamples(s) != 0) ++n;
  ret n/decoder.sampleRate;
}

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: #1018661
Snippet name: lengthOfWAVInSeconds (0 if file doesn't exist)
Eternal ID of this version: #1018661/3
Text MD5: 71ddbdf2423ea2e1f8cf7470563fb3b9
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-08 12:11:55
Source code size: 269 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 395 / 421
Version history: 2 change(s)
Referenced in: [show references]