use of net.beadsproject.beads.ugens.RecordToSample in project narchy by automenta.
the class AudioContext method record.
/**
* Tells the AudioContext to record all output for the given millisecond
* duration, kill the AudioContext, and save the recording to the given file
* path. This is a convenient way to make quick recordings, but may not suit
* every circumstance.
*
* @param timeMS the time in milliseconds to record for.
* @param filename the filename to save the recording to.
* @throws IOException Signals that an I/O exception has occurred.
* @see RecordToSample recorder
* @see Sample sample
*/
public void record(double timeMS, String filename) throws Exception {
Sample s = new Sample(timeMS, audioFormat.outputs, audioFormat.sampleRate);
RecordToSample r;
try {
r = new RecordToSample(this, s);
r.in(out);
out.dependsOn(r);
r.start();
r.after(new AudioContextStopTrigger(this));
} catch (Exception e) {
/* won't happen */
}
while (isRunning()) {
}
s.write(filename);
}
Aggregations