Libraryless. Click here for Pure Java version (2503L/16K).
static CloseableItIt<short[]> decodeWAVToMonoSamples_iterator(File wavFile) { ret decodeWAVToMonoSamples_iterator(wavFile, 4096); } // windowSize is in seconds static CloseableItIt<short[]> decodeWAVToMonoSamples_iterator(File wavFile, double windowSize) ctex { WAVDecoder decoder = new(newFileInputStream(wavFile)); ret decodeWAVToMonoSamples_iterator(decoder, iround(windowSize*decoder.sampleRate)); } // windowSize is in samples static CloseableItIt<short[]> decodeWAVToMonoSamples_iterator(File wavFile, int windowSize) ctex { WAVDecoder decoder = new(newFileInputStream(wavFile)); ret decodeWAVToMonoSamples_iterator(decoder, windowSize); } static CloseableItIt<short[]> decodeWAVToMonoSamples_iterator(WAVDecoder decoder, int windowSize) ctex { ret iteratorFromFunction_f0_autoCloseable(func -> short[] { short[] buf = new short[windowSize]; int n = decoder.readMonoSamples(buf); if (n <= 0) null; ret subArray(buf, 0, n); }, decoder); }
Began life as a copy of #1019662
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1024592 | 
| Snippet name: | decodeWAVToMonoSamples_iterator | 
| Eternal ID of this version: | #1024592/7 | 
| Text MD5: | bab941dc8c58b3043c7857d70390c619 | 
| Transpilation MD5: | a10338d4eec7e50339d4b56888c96d08 | 
| Author: | stefan | 
| Category: | javax / sound | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-02-03 12:51:05 | 
| Source code size: | 999 bytes / 24 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 501 / 646 | 
| Version history: | 6 change(s) | 
| Referenced in: | [show references] |