import javax.sound.sampled.*; svoid spectro_intRangesToWAV(Clip clip, L parts, File wavFile) ctex { if (empty(parts)) ret with deleteFile(wavFile); new L l; int frames = 0; for (IntRange r : parts) { if (nempty(l)) { int n = 44100/2; // half a second l.add(ZerosInputStream(n*2)); frames += n; } int n = r.length()*clip.getFrameTimeSamples(); l.add(clip.getAudio(r.start*clip.getFrameTimeSamples(), n)); frames += n; } AudioFormat format = ((AudioInputStream) first(l)).getFormat(); //temp AudioInputStream stream = AudioSystem.getAudioInputStream(format, sequenceInputStream(l)); temp AudioInputStream stream = new(sequenceInputStream(l), format, frames); AudioSystem.write(stream, AudioFileFormat.Type.WAVE, mkdirsForFile(wavFile)); }