Classes | UGens > InOut | UGens > Buffer

VDiskIn : MultiOutUGen : UGen : AbstractFunction : Object

Stream in audio from a file, with variable rate
Source: DiskIO.sc


Continuously play a longer soundfile from disk. This requires a buffer to be preloaded with one buffer size of sound.

Class Methods

VDiskIn.ar(numChannels, bufnum, rate: 1, loop: 0, sendID: 0)



number of channels


buffer number

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.

controls the rate of playback. Values below 4 are probably fine, but the higher the value, the more disk activity there is, and the more likelihood there will be a problem.

WARNING: the rate does have a practical limit. The following must be true: rate < Buffer's size / ( 2 * s.options.blockSize) e.g with typical default values, this will be 32768 / (2 * 64) = 256.

If the rate is too high, the UGen will not execute, posting a warning.


If loop is set to 1, the soundfile will loop.


If a sendID is given, the UGen sends an OSC message with this ID and the frame index relative to the onset of the Synth each time it reloads the buffer: ['/diskin', nodeID, sendID, frame]. The true frame index into the file is determined by the startFrame given when reading the initial buffer's worth of data, using Buffer: -cueSoundFile or Buffer: -read. VDiskIn does not have access to the frame index used to cue the buffer. So, the frame index sent by OSC is always 0 at the start of the synth node. The user is responsible for adding the cue point: cueStartFrame + msg[3].


This UGen will set the 'done' flag when finished playing.

Inherited class methods

Instance Methods

Inherited instance methods


The same example in OSC Messaging style, see Node Messaging