BASS_CONFIG_BUFFER config option

The playback buffer length for HSTREAM and HMUSIC channels.

    DWORD length


lengthThe buffer length in milliseconds. The minimum length is 10ms, the maximum is 5000 milliseconds. If the length specified is outside this range, it is automatically capped.


The default buffer length is 500 milliseconds. Increasing the length, decreases the chance of the sound possibly breaking-up on slower computers, but also increases the latency for DSP/FX. The buffer length should always be greater than the update period (BASS_CONFIG_UPDATEPERIOD), which determines how often the buffer is refilled.

Small buffer lengths are only required if the sound is going to be changing in real-time, for example, in a soft-synth. If you need to use a small buffer, then the minbuf member of BASS_INFO should be used to get the recommended minimum buffer length supported by the device and its drivers, and add that to the update period plus some margin for the stream's processing. Even then, it is still possible that the sound could break up on some systems, it is also possible that smaller buffers may be fine. So when using small buffers, you should have an option in your software for the user to finetune the length used, for optimal performance.

Using this config option only affects the HMUSIC/HSTREAM channels that are created afterwards, not any that have already been created. So you can have channels with differing buffer lengths by using this config option each time before creating them.

If automatic updating is disabled, make sure you call BASS_Update frequently enough to keep the buffers updated.


Except when using DirectSound output on Windows, the BASS_ATTRIB_BUFFER option can be used to bypass the playback buffer for low latency output.


Use the recommended minimum buffer length with 1ms margin.
DWORD len=BASS_GetConfig(BASS_CONFIG_UPDATEPERIOD); // get update period
BASS_GetInfo(&info); // retrieve device info
len+=info.minbuf+1; // add the 'minbuf' plus 1ms margin
BASS_SetConfig(BASS_CONFIG_BUFFER, len); // set the buffer length

See also