static L soundSourceToShortArrays(double maxSeconds, VF1 source, int channels default 2) { source = new CutOffSoundSource(maxSeconds, source); double[] lr = new[channels]; new L 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; }