BASS.NET API for the Un4seen BASS Audio Library

BASSAttribute Enumeration

BASS.NET API for the Un4seen BASS Audio Library

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public enum BASSAttribute
Members

  Member nameValueDescription
BASS_ATTRIB_FREQ1 The sample rate of a channel.

freq: The sample rate... 0 = original rate (when the channel was created).

This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BassMix add-on, and anything else that wants to use it.

It is not possible to change the sample rate of a channel if the "with FX flag" DX8 effect implementation enabled on it, unless DirectX 9 or above is installed.

Increasing the sample rate of a stream or MOD music increases its CPU usage, and reduces the length of its playback buffer in terms of time. If you intend to raise the sample rate above the original rate, then you may also need to increase the buffer length via the BASS_CONFIG_BUFFER config option to avoid break-ups in the sound.

When using BASS_ChannelSlideAttribute(Int32, BASSAttribute, Single, Int32) to slide this attribute, the BASS_SLIDE_LOG flag can be used to make a slide logarithmic rather than linear.

Platform-specific

When using DirectSound output on Windows, the sample rate will get rounded down to a whole number during playback.

BASS_ATTRIB_VOL2 The volume level of a channel.

volume: The volume level... 0 (silent) to 1 (full). This can go above 1.0 for amplification.

This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BassMix add-on, and anything else that wants to use it. The BASS_FX_VOLUME effect can be used via BASS_ChannelSetFX(Int32, BASSFXType, Int32) to change the level of a channel's sample data.

When using BASS_ChannelSlideAttribute(Int32, BASSAttribute, Single, Int32) to slide this attribute, a negative volume value can be used to fade-out and then stop the channel. When the linear volume curve is in use, the BASS_SLIDE_LOG flag can also be used to make a slide logarithmic rather than linear.

When using DirectSound output on Windows, amplification is not supported so this attribute will be limited to 1.0. On platforms/architectures without floating-point support (see BASS_CONFIG_FLOAT), amplification is limited to 16x.

BASS_ATTRIB_PAN3 The panning/balance position of a channel.

pan: The pan position... -1 (full left) to +1 (full right), 0 = centre.

This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BassMix add-on, and anything else that wants to use it.

It is not possible to set the pan position of a 3D channel. It is also not possible to set the pan position when using speaker assignment, but if needed, it can be done via a DSP function instead (not on mono channels).

Platform-specific

On Windows, this attribute has no effect when speaker assignment is used, except on Windows Vista and newer with the BASS_CONFIG_VISTA_SPEAKERS config option enabled. Balance control could be implemented via a DSP function instead

BASS_ATTRIB_EAXMIX4 The wet (reverb) / dry (no reverb) mix ratio on a sample, stream, or MOD music channel with 3D functionality.

mix: The wet / dry ratio... 0 (full dry) to 1 (full wet), -1 = automatically calculate the mix based on the distance (the default).

Obviously, EAX functions have no effect if the output device does not support EAX. BASS_GetInfo(BASS_INFO) can be used to check that. EAX only affects 3D channels, but EAX functions do not require BASS_Apply3D to apply the changes.

Additional ERROR CODEDescription
BASS_ERROR_NOEAXThe channel does not have EAX support. EAX only applies to 3D channels that are mixed by the hardware/drivers. BASS_ChannelGetInfo(Int32, BASS_CHANNELINFO) can be used to check if a channel is being mixed by the hardware.

EAX is only supported on Windows.

BASS_ATTRIB_NOBUFFER5 Non-Windows: Disable playback buffering?

nobuffer: Disable playback buffering... 0 = no, else yes..

A playing channel is normally asked to render data to its playback buffer in advance, via automatic buffer updates or the BASS_Update(Int32) and BASS_ChannelUpdate(Int32, Int32) functions, ready for mixing with other channels to produce the final mix that is given to the output device. When this attribute is switched on (the default is off), that buffering is skipped and the channel will only be asked to produce data as it is needed during the generation of the final mix. This allows the lowest latency to be achieved, but also imposes tighter timing requirements on the channel to produce its data and apply any DSP/FX (and run mixtime syncs) that are set on it; if too long is taken, there will be a break in the output, affecting all channels that are playing on the same device.

The channel's data is still placed in its playback buffer when this attribute is on, which allows BASS_ChannelGetData(Int32, IntPtr, Int32) and BASS_ChannelGetLevel(Int32) to be used, although there is likely to be less data available to them due to the buffer being less full.

This attribute can be changed mid-playback. If switched on, any already buffered data will still be played, so that there is no break in sound.

This attribute is not available on Windows, as BASS does not generate the final mix.

BASS_ATTRIB_VBR6 Unknown, Gets the VBR vallue?
BASS_ATTRIB_CPU7 The CPU usage of a channel.

cpu: The CPU usage (in percentage).

This attribute gives the percentage of CPU that the channel is using, including the time taken by decoding and DSP processing, and any FX that are not using the "with FX flag" DX8 effect implementation. It does not include the time taken to add the channel's data to the final output mix during playback. The processing of some add-on stream formats may also not be entirely included, if they use additional decoding threads; see the add-on documentation for details.

Like BASS_GetCPU, this function does not strictly tell the CPU usage, but rather how timely the processing is. For example, if it takes 10ms to generate 100ms of data, that would be 10%. If the reported usage exceeds 100%, that means the channel's data is taking longer to generate than to play. The duration of the data is based on the channel's current sample rate (BASS_ATTRIB_FREQ).

A channel's CPU usage is updated whenever it generates data. That could be during a playback buffer update cycle, or a BASS_Update(Int32) call, or a BASS_ChannelUpdate(Int32, Int32) call. For a decoding channel, it would be in a BASS_ChannelGetData(Int32, IntPtr, Int32) or BASS_ChannelGetLevel(Int32) call.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_SRC8 The sample rate conversion quality of a channel.

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

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(Int32, Int32, BASSFlag, STREAMPROC, IntPtr) or BASS_MusicLoad(String, Int64, Int32, BASSFlag, Int32) or Un4seen.Bass.AddOn.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(Int32, IntPtr, Int32). Although this attribute has no direct effect on decoding channels, it is still available so that it can be used by the Un4seen.Bass.AddOn.Mix 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.

BASS_ATTRIB_NET_RESUME9 The download buffer level required to resume stalled playback.

resume: The resumption level in percent... 0 - 100 (the default is 50%).

This attribute determines what percentage of the download buffer (BASS_CONFIG_NET_BUFFER) needs to be filled before playback of a stalled internet stream will resume. It also applies to 'buffered' user file streams created with BASS_StreamCreateFileUser(BASSStreamSystem, BASSFlag, BASS_FILEPROCS, IntPtr). The buffering progress can be monitored with BASS_StreamGetFilePosition(Int32, BASSStreamFilePosition) (BASS_FILEPOS_BUFFERING).

This attribute can be set at any time, and changes take immediate effect, including mid-stall. The initial value is determined by the BASS_CONFIG_NET_PREBUF config option.

BASS_ATTRIB_SCANINFO10 The scanned info of a channel.

scaninfo: The scanned info.

size: The size of the scanned info.

This attribute is the information that is scanned from a file when the BASS_STREAM_PRESCAN flag is used in a BASS_StreamCreateFile(String, Int64, Int64, BASSFlag) call or when the BASS_POS_SCAN flag is used with BASS_ChannelSetPosition(Int32, Int64, BASSMode). It is supported on MP3/MP2/MP1 files and chained OGG files. It may be supported by add-ons too; see the documentation.

The structure of the scanned info may change in future versions, so if the data is stored, be prepared for BASS_ChannelSetAttributeEx to fail when trying to apply it; the file can be scanned again if that happens.

BASS_ATTRIB_NORAMP11 Disable Playback ramping?

noramp (int): Enable or disable playback ramping... 0 = enable ramping, 1 = disable ramping, 2 = disable ramping-in only, 3 = disable ramping-out only.

By default, a channel will be ramped-in when starting playback and ramped-out when stopping playback, to avoid sudden level changes that could result in a click sound each time. That ramping can be disabled by enabling this option. Volume (BASS_ATTRIB_VOL) and panning (BASS_ATTRIB_PAN) changes are always ramped regardless of this option setting.

Ramping-in is skipped when a channel's sample data begins at a low level (below -42dB), and ramping-out is skipped when a channel is muted. Ramping-out requires data in the channel's playback buffer, so it generally does not apply when buffering has been disabled via the BASS_ATTRIB_BUFFER option unless the channel is a 'push' stream or BASS_ChannelUpdate(Int32, Int32) is used to pre-buffer some data.

This attribute can be set at any time, and changes take immediate effect. A channel's initial setting is determined by the BASS_CONFIG_NORAMP config option.

BASS_ATTRIB_BITRATE12 Gets the average bitrate (bkps).

bitrate: The bitrate in kilobits per second (bkps).

This attribute gives the average bitrate of the file's audio data. If the file also contains video, that is excluded from the bitrate calculation. This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_BUFFER13 Playback buffering length.

buffer The buffering length in seconds... 0 = no buffering. This is automatically capped to the full length of the channel's playback buffer.

This attribute allows the amount of playback buffering to be changed without recreating the channel to get a new buffer. It limits how much data the update thread(s) or the BASS_Update(Int32) function will try to keep in the playback buffer; it cannot exceed the length of the buffer, determined by the BASS_CONFIG_BUFFER setting at the time of its creation. BASS_ChannelUpdate(Int32, Int32) is unaffected and can still be used to fill the entire buffer. Push streams (using STREAMPROC_PUSH) are also unaffected; they will always place as much data as possible in their playback buffers.

When this attribute is set to 0, no data will be buffered and the channel will only be asked to produce data as it is needed during the generation of the final mix. This allows the lowest latency to be achieved, but also imposes tighter timing requirements on the channel to produce its data and apply any DSP/FX (and run mixtime syncs) that are set on it; if too long is taken, there will be a break in the output, affecting all channels that are playing on the same device. The channel's data is still placed in its playback buffer, which allows BASS_ChannelGetData(Int32, IntPtr, Int32) and BASS_ChannelGetLevel(Int32) to be used, although there is likely to be less data available to them due to the buffer being less full.

This attribute can be changed mid-playback. Any excess data that is currently in the playback buffer will still be played but not replaced.

The default value is the channel's full playback buffer length, as determined by the BASS_CONFIG_BUFFER setting at the time of its creation.

This attribute is not available when using DirectSound output on Windows, as BASS does not generate the final mix.

BASS_ATTRIB_GRANULE14 The processing granularity of a channel.

handle: The channel handle... a HMUSIC, HSTREAM, HRECORD

unit: The processing unit size in sample frames... 0 = none

This attribute allows a channel's processing to be in units of a certain size, which can be helpful for some DSP processing. It does not apply to decoding channels or recording channels without a RECORDPROC; their procesing is controlled by BASS_ChannelGetData(Int32, IntPtr, Int32).

Each processing cycle will be on a whole number of units, not necessarily only one unit, and the number of units can vary between cycles depending on how much space there is in the channel's playback buffer (or captured data in a recording buffer). There might not be a whole number of units at the end of a file or when a stream stalls.

When granularity is enabled (non-0), it can change the timing of any DSP/FX changes that are made in mixtime sync callbacks. That is because the DSP/FX processing is done on the entire block of data at the end of the processing cycle then (rather than splitting it at the sync positions), to maintain the specified granularity, resulting in the changes effectively being applied at the start of the processing cycle.

The default value is 0 (none). Changes take immediate effect.

BASS_ATTRIB_USER15 User-defined info.

handle: The channel handle.

info: The info.

size: The size of the info... 1 (min) to 8 (max).

This attribute can be used to associate any info with a channel. It can be set to a pointer for larger info.

BASS_ATTRIB_TAIL16 An amount of time to add to the length of a channel.

handle: The channel handle... a HMUSIC, HSTREAM.

tail: The amount of time to add in seconds.

This attribute allows some silence to be added to the end a channel, which can be useful for hearing the tail of DSP/FX processing on the channel, eg. from reverb or echo effects. The silence is not added when looping is enabled.

The default value is 0. Changes take immediate effect.

Any BASS_SYNC_END syncs that are set on the channel (via BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr)) will be triggered twice: once at the normal end position and again at the end of the tail. The SYNCPROC callback's 'data' parameter will indicate which has occurred.

BASS_ATTRIB_PUSH_LIMIT17 The maximum amount of data that a push stream can have queued.

handle: The push stream handle.

limit: The maximum amount of data in bytes... 0 = no limit.

By default, the amount of data that a push stream (using STREAMPROC_PUSH) can hold is limited only by available memory. This attribute can be used to set a lower limit to prevent a stream's buffer possibly getting out of control, eg. if playback stops but data pushing continues. This limit does not include the stream's playback buffer, if it has one.

The limit can be changed at any time. If the new limit is lower than what the stream currently holds then the stream will be allowed to stay above the limit but no more data will be accepted until the excess is used.

BASS_ATTRIB_DOWNLOADPROC18 The download callback function on an internet stream.

handle: The channel handle.

info: A pointer to a DOWNLOADPROC callback function and user parameter. The user parameter is optional; if it is not included then the existing value will be kept.

size: The size of the info. This should be the size of one or two pointers, depending on whether a user parameter is included.

This attribute can be used to change the DOWNLOADPROC callback function that was set in a BASS_StreamCreateURL(String, Int32, BASSFlag, DOWNLOADPROC, IntPtr) call. The new callback function will only receive data that is subsequently downloaded, not any that has already been downloaded. Callbacks can be disabled by setting it to .

This attribute can be set at any time, including within a DOWNLOADPROC function.

BASS_ATTRIB_VOLDSP19 The volume level applied in the DSP chain of a channel.

handle: The channel handle.

volume: The volume level... 0 = silent, 1.0 = normal, above 1.0 = amplification.

Unlike BASS_ATTRIB_VOL, this attribute does have direct effect on decoding/recording channels and is present in the sample data returned by BASS_ChannelGetData(Int32, IntPtr, Int32), because it is applied in the channel's DSP chain. By default, the effect is applied at the start of the DSP chain, so that it is present in the data received by all DSP/FX, but that can be changed via the BASS_ATTRIB_VOLDSP_PRIORITY attribute.

During playback, the effect of changes to this attribute are not heard instantaneously due to buffering. This latency can be reduced via the BASS_ATTRIB_BUFFER attribute, but it is generally better to use the BASS_ATTRIB_VOL attribute instead for playback volume control.

Multiple DSP volume controls and ramping/fading are possible with the BASS_FX_VOLUME effect via BASS_ChannelSetFX(Int32, BASSFXType, Int32).

BASS_ATTRIB_VOLDSP_PRIORITY20 The priority of the volume DSP.

handle: The channel handle.

priority: The priority... -2147483648 (min) to 2147483647 (max). This will be rounded down to a whole number.

This attribute determines where in the DSP chain the BASS_ATTRIB_VOLDSP attribute is applied; its effect will not be present in the data received by DSP functions with a higher priority. This attribute is write-only, so its value is not available via BASS_ChannelGetAttribute(Int32, BASSAttribute, Single).

The default value is 2147483647 (max). It cannot be changed until after the BASS_ATTRIB_VOLDSP attribute is first set on the channel.

BASS_ATTRIB_MUSIC_AMPLIFY256 The amplification level of a MOD music.

amp: Amplification level... 0 (min) to 100 (max). This will be rounded down to a whole number.

As the amplification level get's higher, the sample data's range increases, and therefore, the resolution increases. But if the level is set too high, then clipping can occur, which can result in distortion of the sound.

You can check the current level of a MOD music at any time by using BASS_ChannelGetLevel(Int32). By doing so, you can decide if a MOD music's amplification level needs adjusting.

The default amplification level is 50.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_PANSEP257 The pan separation level of a MOD music.

pansep: Pan separation... 0 (min) to 100 (max), 50 = linear. This will be rounded down to a whole number.

By default BASS uses a linear panning "curve". If you want to use the panning of FT2, use a pan separation setting of around 35. To use the Amiga panning (ie. full left and right) set it to 100.

BASS_ATTRIB_MUSIC_PSCALER258 The position scaler of a MOD music.

scale: The scaler... 1 (min) to 256 (max). This will be rounded down to a whole number.

When calling BASS_ChannelGetPosition(Int32, BASSMode), the row (HIWORD) will be scaled by this value. By using a higher scaler, you can get a more precise position indication.

The default scaler is 1.

Examples

Get the position of a MOD music accurate to within a 10th of a row:
// set the scaler
Bass.BASS_ChannelSetAttribute(music, BASSAttribute.BASS_ATTRIB_MUSIC_PSCALER, 10f);
int pos = Bass.BASS_MusicGetOrderPosition(music);
// the order
int order = Utils.LowWord32(pos);
// the row
int row = HighWord32(pos) / 10;
// the 10th of a row
int row10th = HighWord32(pos) % 10;

BASS_ATTRIB_MUSIC_BPM259 The BPM of a MOD music.

bpm: The BPM... 1 (min) to 255 (max). This will be rounded down to a whole number.

This attribute is a direct mapping of the MOD's BPM, so the value can be changed via effects in the MOD itself.

Note that by changing this attribute, you are changing the playback length.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_SPEED260 The speed of a MOD music.

speed: The speed... 0 (min) to 255 (max). This will be rounded down to a whole number.

This attribute is a direct mapping of the MOD's speed, so the value can be changed via effects in the MOD itself.

The "speed" is the number of ticks per row. Setting it to 0, stops and ends the music. Note that by changing this attribute, you are changing the playback length.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_VOL_GLOBAL261 The global volume level of a MOD music.

volume: The global volume level... 0 (min) to 64 (max, 128 for IT format). This will be rounded down to a whole number.

This attribute is a direct mapping of the MOD's global volume, so the value can be changed via effects in the MOD itself. The "speed" is the number of ticks per row. Setting it to 0, stops and ends the music. Note that by changing this attribute, you are changing the playback length.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_ACTIVE262 The number of active channels in a MOD music.

active: The number of channels.

This attribute gives the number of channels (including virtual) that are currently active in the decoder, which may not match what is being heard during playback due to buffering. To reduce the time difference, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_MUSIC_VOL_CHAN512 The volume level of a channel in a MOD music + channel#.

channel: The channel to set the volume of... 0 = 1st channel.

volume: The volume level... 0 (silent) to 1 (full).

The volume curve used by this attribute is always linear, eg. 0.5 = 50%. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this. The volume level of all channels is initially 1 (full).

This attribute can also be used to count the number of channels in a MOD Music.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

Examples

Count the number of channels in a MOD music:
int channels = 0;
float dummy;
while (Bass.BASS_ChannelGetAttribute(music, (BASSAttribute)((int)BASS_ATTRIB_MUSIC_VOL_CHAN + channels), ref dummy))
{
  channels++; 
}

BASS_ATTRIB_MUSIC_VOL_INST768 The volume level of an instrument in a MOD music + inst#.

inst: The instrument to set the volume of... 0 = 1st instrument.

volume: The volume level... 0 (silent) to 1 (full).

The volume curve used by this attribute is always linear, eg. 0.5 = 50%. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this. The volume level of all instruments is initially 1 (full). For MOD formats that do not use instruments, read "sample" for "instrument".

This attribute can also be used to count the number of instruments in a MOD music.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

Examples

Count the number of instruments in a MOD music:
int instruments = 0;
float dummy;
while (Bass.BASS_ChannelGetAttribute(music, (BASSAttribute)((int)BASSAttribute.BASS_ATTRIB_MUSIC_VOL_INST + instruments), ref dummy))
{
  instruments++; 
}

BASS_ATTRIB_TEMPO65536 BASS_FX Tempo: The Tempo in percents (-95%..0..+5000%).
BASS_ATTRIB_TEMPO_PITCH65537 BASS_FX Tempo: The Pitch in semitones (-60..0..+60).
BASS_ATTRIB_TEMPO_FREQ65538 BASS_FX Tempo: The Samplerate in Hz, but calculates by the same % as BASS_ATTRIB_TEMPO.
BASS_ATTRIB_TEMPO_OPTION_USE_AA_FILTER65552 BASS_FX Tempo Option: Use FIR low-pass (anti-alias) filter (gain speed, lose quality)? =1 (default), =0.

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

On iOS, Android, WinCE and Linux ARM platforms this is by default disabled for lower CPU usage.

BASS_ATTRIB_TEMPO_OPTION_AA_FILTER_LENGTH65553 BASS_FX Tempo Option: FIR low-pass (anti-alias) filter length in taps (8 .. 128 taps, default = 32, should be %4).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO65554 BASS_FX Tempo Option: Use quicker tempo change algorithm (gain speed, lose quality)? =1, =0 (default).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MS65555 BASS_FX Tempo Option: Tempo Sequence in milliseconds (default = 82).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MS65556 BASS_FX Tempo Option: SeekWindow in milliseconds (default = 14).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_TEMPO_OPTION_OVERLAP_MS65557 BASS_FX Tempo Option: Tempo Overlap in milliseconds (default = 12).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_TEMPO_OPTION_PREVENT_CLICK65558 BASS_FX Tempo Option: Prevents clicks with tempo changes (default = FALSE).

See BASS_FX_TempoCreate(Int32, BASSFlag) for details.

BASS_ATTRIB_REVERSE_DIR69632 BASS_FX Reverse: The Playback direction (-1=BASS_FX_RVS_REVERSE or 1=BASS_FX_RVS_FORWARD).
BASS_ATTRIB_MIDI_PPQN73728 BASSMIDI: Gets the Pulses Per Quarter Note (or ticks per beat) value of the MIDI file.

ppqn: The PPQN value.

This attribute is the number of ticks per beat as defined by the MIDI file; it will be 0 for MIDI streams created via BASS_MIDI_StreamCreate(Int32, BASSFlag, Int32), It is also read-only, so can't be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

Examples

Get the currnet position of a MIDI stream in beats:
float ppqn;
Bass.BASS_ChannelGetAttribute(midi, BASSAttribute.BASS_ATTRIB_MIDI_PPQN, ref ppqn);
long tick = Bass.BASS_ChannelGetPosition(midi, BASSMode.BASS_POS_MIDI_TICK);
float beat = tick / ppqn;

BASS_ATTRIB_MIDI_CPU73729 BASSMIDI: The maximum percentage of CPU time that a MIDI stream can use.

limit: The CPU usage limit... 0 to 100, 0 = unlimited.

It is not strictly the CPU usage that is measured, but rather how timely the stream is able to render data. For example, a limit of 50% would mean that the rendering would need to be at least 2x real-time speed. When the limit is exceeded, BASSMIDI will begin killing voices, starting with the most quiet.

When the CPU usage is limited, the stream's samples are loaded asynchronously so that any loading delays (eg. due to slow disk) do not hold up the stream for too long. If a sample cannot be loaded in time, then it will be silenced until it is available and the stream will continue playing other samples as normal in the meantime. This does not affect sample loading via BASS_MIDI_StreamLoadSamples(Int32), which always operates synchronously.

By default, a MIDI stream will have no CPU limit.

BASS_ATTRIB_MIDI_CHANS73730 BASSMIDI: The number of MIDI channels in a MIDI stream.

channels: The number of MIDI channels... 1 (min) - 128 (max). For a MIDI file stream, the minimum is 16.

New channels are melodic by default. Any notes playing on a removed channel are immediately stopped.

BASS_ATTRIB_MIDI_VOICES73731 BASSMIDI: The maximum number of samples to play at a time (polyphony) in a MIDI stream.

voices: The number of voices... 1 (min) - 1000 (max).

If there are currently more voices active than the new limit, then some voices will be killed to meet the limit. The number of voices currently active is available via the BASS_ATTRIB_MIDI_VOICES_ACTIVE attribute.

A MIDI stream will initially have a default number of voices as determined by the BASS_CONFIG_MIDI_VOICES config option.

BASS_ATTRIB_MIDI_VOICES_ACTIVE73732 BASSMIDI: The number of samples currently playing in a MIDI stream.

voices: The number of voices.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_MIDI_STATE73733 BASSMIDI: The current state of a MIDI stream (2nd overload).

state: the buffer of the state data.

size: the size of the state data buffer.

This attribute includes the state of all events in all MIDI channels, except for MIDI_EVENT_NOTE (playing notes are not preserved) and MIDI_EVENT_TEMPO. BASS_MIDI_StreamGetEvent(Int32, Int32, BASSMIDIEvent) can be used to get the MIDI_EVENT_TEMPO event state.

The structure of the MIDI state data may change in future versions, so if the data is stored, be prepared for BASS_ChannelSetAttribute(Int32, BASSAttribute, Single) to fail when trying to apply it.

BASS_ATTRIB_MIDI_SRC73734 BASSMIDI: The sample rate conversion quality of a MIDI stream's samples.

quality: The sample rate conversion quality... 0 = linear interpolation, 1 = 8 point sinc interpolation, 2 = 16 point sinc interpolation.

The samples in a soundfont will usually need to be played at rates that are different to their original rates. 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.

When this attribute setting is changed, the BASS_MIDI_SINCINTER flag is automatically set or unset on the MIDI stream accordingly, and vice versa. Changes can be made at any time, but the effect of changes during playback will not be heard instantaneously due to buffering.

Platform-specific:

On Android and iOS, sinc interpolation requires a NEON supporting CPU. Sinc interpolation is not available on Windows CE. 16 point sinc interpolation is only available on Windows/OSX/Linux and requires an SSE2 supporting CPU.

BASS_ATTRIB_MIDI_KILL73735 BASSMIDI: Disable killed note fading?

bool: 0 = killed note fading enabled (default), 1 = killed note fading disabled.

BASS_ATTRIB_MIDI_SPEED73736 BASSMIDI: Tempo modification.

handle: The MIDI stream handle

speed: The tempo change... 1.0 = normal, below 1.0 = slower, above 1.0 = faster. The final tempo is the product of this value and the original tempo.

Changing the tempo affects the stream length, and the BASS_ChannelGetLength(Int32, BASSMode) byte value will no longer be valid. Seeking is not affected.

Changes can be made at any time, but the effect of changes during playback may not be heard instantaneously due to buffering

BASS_ATTRIB_MIDI_REVERB73737 BASSMIDI: The reverb effect level.

handle: The MIDI stream handle.

level: The reverb level... 0 = silent.

This attribute is applied on top of the MIDI_EVENT_REVERB_LEVEL event value; the final reverb level is the product of both. Unlike the MIDI_EVENT_REVERB_LEVEL event value, this setting cannot be changed by a MIDI file.

The default value is 1.0. Changes can be made at any time, but the effect of changes during playback may not be heard instantaneously due to buffering.

BASS_ATTRIB_MIDI_VOL73738 BASSMIDI: The mix level of a MIDI stream.

handle: The MIDI stream handle

volume: The volume level... 0 = silent, 1.0 = normal/default, above 1.0 = amplification.

The volume curve used by this attribute is always linear, eg. 0.5 = 50%. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. This latency can be reduced via the BASS_ATTRIB_BUFFER attribute.

This attribute differs from the BASS_ATTRIB_VOL attribute in that it changes the level of the generated data, not just playback of it. It can be useful for reducing the level to prevent clipping/distortion.

BASS_ATTRIB_MIDI_TRACK_VOL73984 BASSMIDI: The volume level of a track in a MIDI file stream + track#.

track#: The track to set the volume of... 0 = first track.

volume: The volume level (0.0=silent, 1.0=normal/default).

The volume curve used by this attribute is always linear, eg. 0.5 = 50%. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this.

During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

This attribute can also be used to count the number of tracks in a MIDI file stream. MIDI streams created via BASS_MIDI_StreamCreate(Int32, BASSFlag, Int32) do not have any tracks.

Examples

Count the number of tracks in a MIDI stream:
int tracks = 0;
float dummy;
while (Bass.BASS_ChannelGetAttribute(midi, (BASSAttribute)((int)BASSAttribute.BASS_ATTRIB_MIDI_TRACK_VOL + tracks), ref dummy))
{
  tracks++; 
}

BASS_ATTRIB_OPUS_ORIGFREQ77824 BASSOPUS: The sample rate of an Opus stream's source material.

freq: The sample rate.

Opus streams always have a sample rate of 48000 Hz, and an Opus encoder will resample the source material to that if necessary. This attribute presents the original sample rate, which may be stored in the Opus file header. This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_DSD_GAIN81920 BASSdsd: The gain applied when converting to PCM.

gain: The gain in decibels.

This attribute is only applicable when converting to PCM, and is unavailable when producing DSD-over-PCM or raw DSD data. The default setting is determined by the BASS_CONFIG_DSD_GAIN config option.

BASS_ATTRIB_DSD_RATE81921 BASSdsd: The DSD sample rate.

rate: The DSD sample rate.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_ATTRIB_MIXER_LATENCY86016 BASSmix: Custom output latency.

latency: The latency in seconds.

When a mixer is played by BASS, the BASS_Mixer_ChannelGetData(Int32, IntPtr, Int32), BASS_Mixer_ChannelGetLevel(Int32) and BASS_Mixer_ChannelGetPosition(Int32, BASSMode) functions will get the output latency and account for that so that they reflect what is currently being heard, but that cannot be done when a different output system is used, eg. ASIO or WASAPI. In that case, this attribute can be used to tell the mixer what the output latency is, so that those functions can still account for it. The mixer needs to have the BASS_STREAM_DECODE and BASS_MIXER_POSEX flags set to use this attribute.

The default setting is 0 (no accounting for latency). Changes take immediate effect.

BASS_ATTRIB_MIXER_THREADS86017 BASSmix: The number of threads to use for mixing.

handle: The mixer stream handle.

threads: The number of threads... 1 (min) to 16 (max).

The number of mixing threads determines how many source channels can be processed simultaneously by the mixer. If there are multiple CPU cores available then processing multiple sources simultaneously (if there are multiple sources) will generally mean that the final mix can be produced more quickly. When the BASS_MIXER_CHAN_LIMIT flag is set on a source, that source will always be processed alone first because it determines how much data may be processed from the other sources.

The default setting is 1. Changes take immediate effect.

BASS_ATTRIB_MIXER_VOL86018 BASSmix: Master volume level of a mixer.

handle: The mixer stream handle.

volume: volume level... 0 = silent, 1.0 = normal/default, above 1.0 = amplification.

This attribute differs from the BASS_ATTRIB_VOL attribute in that it changes the level of the generated data, not just playback of it.

BASS_ATTRIB_SPLIT_ASYNCBUFFER86032 BASSmix: Amount of data to asynchronously buffer from a splitter's source.

buffer: The amount to buffer, in seconds... 0 = disable asynchronous buffering. The asynchronous buffering will be limited to the splitter's buffer length, as determined by BASS_CONFIG_SPLIT_BUFFER.

A splitter stream will usually get data from its source only when it is needed. This attribute allows the data to be gotten ahead of time asynchronously instead, so that it is ready for the splitter to access immediately when needed. This is not really useful with normal BASS playback (which is already buffered) but it can be used to implement buffering in other cases, eg. for mixer sources. The setting applies to all splitter streams that have the same source.

When there are multiple splitters with the same source, the asynchronous buffering is based on the most advanced of them, which means that the asynchronous buffer length should be under the splitter buffer length (BASS_CONFIG_SPLIT_BUFFER) to allow the splitter positions to get apart from each other without the buffer overflowing for any of them. That margin should be at least equal to the maximum amount that you expect the splitter positions to get apart at any time.

By default, the asynchronous buffering will try to fill any space in the buffer in one data request of the source. It can be broken down into smaller amounts via the BASS_ATTRIB_SPLIT_ASYNCPERIOD attribute.

If a splitter stream needs more data than has been buffered then it will revert to synchronously getting data from the source for the remainder, unless it has the BASS_SPLIT_SLAVE flag set.

The amount of data that a splitter has buffered can be retrieved from BASS_Split_StreamGetAvailable(Int32).

The default setting is 0 (no asynchronous buffering). Changes take immediate effect.

BASS_ATTRIB_SPLIT_ASYNCPERIOD86033 BASSmix: Maximum amount of data to asynchronously buffer at a time from a splitter's source.

period: The maximum amount to data to asynchronously buffer at a time from the source, in seconds... 0 = as much as possible.

When asynchronous buffering is enabled via the BASS_ATTRIB_SPLIT_ASYNCBUFFER attribute, this attribute limits how much data is requested from the source at a time. When there is more space available in the buffer, the request will be repeated until the space is filled.

The setting applies to all splitter streams that have the same source. The default setting is 0 (as much as possible). Changes take immediate effect.

BASS_ATTRIB_WEBM_TRACK90112 BASSWEBM: The active track number.

track: The track number... 1 = first.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single).

BASS_SLIDE_LOG16777216 Flag: Slide the attribute's value logarthmically rather than linearly. This cannot be used when going from positive to negative or vice versa. An exception is when using a negative value with BASS_ATTRIB_VOL to fade-out and stop.
See Also

Reference