Classes | UGens > InOut | UGens > Buffer

DiskOut : UGen : AbstractFunction : Object

Record to a soundfile to disk.
Source: DiskIO.sc


Record to a soundfile to disk. Uses a Buffer.

See RecordBuf for recording into a buffer in memory.

Disk recording procedure

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:

  1. Define a DiskOut SynthDef, as shown in the example below.
  2. Allocate a Buffer for recording.
    • The buffer size should be a power of two.
    • A duration of at least one second is recommended: s.sampleRate.nextPowerOfTwo.
    • Do not allocate the buffer inside the SynthDef.
    • Keep the buffer in a variable.

  3. Specify the file path and recording format using Buffer: -write, with the leaveOpen flag set to true. This is the only way to set the file path and recording format.
  4. Create a Synth node to run the DiskOut UGen.
  5. When recording is finished, stop the DiskOut synth.
  6. Close the buffer: b.close. This step updates the recorded file's audio header. Without it, the file will be unusable.
  7. Free the buffer: 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.)

Class Methods

DiskOut.ar(bufnum, channelsArray)



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.

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.

Inherited class methods

Instance Methods

Inherited instance methods


Object Style

Messaging Style