Libraryless. Click here for Pure Java version (3479L/20K).
1 | static short[] decodeWAVToMonoSamples(File wavFile) ctex {
|
2 | temp WAVDecoder decoder = new(newFileInputStream(wavFile)); |
3 | ret decodeWAVToMonoSamples(decoder, wavFile); |
4 | } |
5 | |
6 | // weird signature |
7 | static short[] decodeWAVToMonoSamples(WAVDecoder decoder, File wavFile) {
|
8 | ret decodeWAVToMonoSamples(decoder); |
9 | } |
10 | |
11 | static short[] decodeWAVToMonoSamples(WAVDecoder decoder, long maxSamples default Int.MAX_VALUE) ctex {
|
12 | new L<short[]> chunks; |
13 | while ping (maxSamples > 0) {
|
14 | short[] buf = new short[(int) min(maxSamples, 4096)]; |
15 | int n = decoder.readMonoSamples(buf); |
16 | if (n <= 0) break; |
17 | chunks.add(subArray(buf, 0, n)); |
18 | maxSamples -= n; |
19 | } |
20 | ret concatShortArrays(chunks); |
21 | } |
Began life as a copy of #1016685
download show line numbers debug dex old transpilations
Travelled to 11 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1019662 |
| Snippet name: | decodeWAVToMonoSamples |
| Eternal ID of this version: | #1019662/6 |
| Text MD5: | 4381157c770c1dbc638f5dc5addb1ffe |
| Transpilation MD5: | 92338ae60a577f52bd3a94cfd1206a40 |
| 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:22:14 |
| Source code size: | 707 bytes / 21 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 524 / 683 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |