Record to a soundfile to disk. Uses a Buffer.
See RecordBuf for recording into a buffer in memory.
Recording to disk involves several steps, which should be taken in the right order. Server: -record performs these steps for you. To record arbitrary buses using DiskOut explicitly, make sure to do the following:
s.sampleRate.nextPowerOfTwo
.leaveOpen
flag set to true
. This is the only way to set the file path and recording format.b.close
. This step updates the recorded file's audio header. Without it, the file will be unusable.b.free
.These steps are illustrated in the Examples section. In general, only the "Object Style" approach is needed. ("Messaging Style" is provided as a historical reference, but it isn't needed for typical use.)
bufnum |
The number of the buffer to write to (prepared with /b-write or Buffer.write) NOTE: The Buffer's numFrames must be a power of two and is recommended to be at least 65536 -- preferably 131072 or 262144. Smaller buffer sizes mean more frequent disk access, which can cause glitches. |
channelsArray |
The Array of channels to write to the file. NOTE: The number of channels in the buffer and the channelsArray must be the same, otherwise DiskOut will fail silently (and not write anything to your file). |
The number of frames written to disk.