BASS_ATTRIB_SRC attribute


The sample rate conversion quality of a channel.

BASS_ChannelSetAttribute(
    DWORD handle,
    BASS_ATTRIB_SRC,
    float quality
);

Parameters

handleThe channel handle.
qualityThe sample rate conversion quality... 0 = linear interpolation, 1 = 8 point sinc interpolation, 2 = 16 point sinc interpolation, 3 = 32 point sinc interpolation. Other values are also accepted but will be interpreted as 0 or 3, depending on whether they are lower or higher.

Remarks

When a channel has a different sample rate to what the output device is using, the channel's sample data will need to be converted to match the output device's rate during playback. This attribute determines how that is done. The linear interpolation option uses less CPU, but the sinc interpolation gives better sound quality (less aliasing), with the quality and CPU usage increasing with the number of points. A good compromise for lower spec systems could be to use sinc interpolation for music playback and linear interpolation for sound effects.

Whenever possible, a channel's sample rate should match the output device's rate to avoid the need for any sample rate conversion. The device's sample rate could be used in BASS_StreamCreate or BASS_MusicLoad or MIDI stream creation calls, for example.

The sample rate conversion occurs (when required) during playback, after the sample data has left the channel's playback buffer, so it does not affect the data delivered by BASS_ChannelGetData. Although this attribute has no direct effect on decoding channels, it is still available so that it can be used by the BASSmix add-on and anything else that wants to use it.

This attribute can be set at any time, and changes take immediate effect. A channel's initial setting is determined by the BASS_CONFIG_SRC config option, or BASS_CONFIG_SRC_SAMPLE in the case of a sample channel.

Platform-specific

On Windows, sample rate conversion is handled by Windows or the output device/driver rather than BASS, so this setting has no effect on playback there.

See also

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute, BASS_CONFIG_SRC, BASS_CONFIG_SRC_SAMPLE