Libraryless. Click here for Pure Java version (3286L/18K).
static L<short[]> soundSourceToShortArrays(double maxSeconds, VF1<double[]> source, int channels default 2) { source = new CutOffSoundSource(maxSeconds, source); double[] lr = new[channels]; new L<short[]> out; short[] buf = new short[1024]; int i = 0; while licensed { source.get(lr); if (isNaN(lr[0])) break; for c to channels: buf[i++] = clipShort(lr[c]); if (i >= l(buf)) { out.add(buf); buf = new short[l(buf)]; i = 0; } } if (i > 0) out.add(subShortArray(buf, 0, i)); ret out; }
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: | #1018701 |
Snippet name: | soundSourceToShortArrays - stereo by default |
Eternal ID of this version: | #1018701/6 |
Text MD5: | e277eefb61d9f37e7f1a0ba4d9f72d68 |
Transpilation MD5: | 381f5279251f81007eb94dc137ede68a |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-03 03:12:08 |
Source code size: | 570 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 360 / 429 |
Version history: | 5 change(s) |
Referenced in: | [show references] |