BASS.NET API for the Un4seen BASS Audio LibraryBassFxBASS_FX_BPM_BeatGetParameters Method (Int32, Single, Single, Single)BASS.NET API for the Un4seen BASS Audio Library
Gets the current beat detection parameter values.

Namespace: Un4seen.Bass.AddOn.Fx
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static bool BASS_FX_BPM_BeatGetParameters(
	int handle,
	ref float bandwidth,
	ref float centerfreq,
	ref float beat_rtime


Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format.
Type: SystemSingle
Current bandwidth in Hz.
Type: SystemSingle
Current center-frequency in Hz of the band pass filter.
Type: SystemSingle
Current beat release time in ms.

Return Value

Type: Boolean
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.

Beat detection is using a Band Pass Filter. A band-pass filter is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range. So the bandwidth parameter defines the range around a center-frequency to include in the beat detection algo. The centerfreq parameter actually defines the center-frequency of the band pass filter. Once a beat is detected, the beat_rtime parameter defines the time in ms. in which no other beat will be detected after that just detected beat. The background is, that often you have kind-of 'double beats' in a drum set. So the beat_rtime should avoid, that a second (quickly repeated beat) beat is detected.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.


Get the current beat parameters:
Dim bandwidth As Single = 0F
Dim centerfreq As Single = 0F
Dim beat_rtime As Single = 0F
If BassFx.BASS_FX_BPM_BeatGetParameters(stream, bandwidth, centerfreq, beat_rtime) Then
  Console.WriteLine("Bandwidth={0}, Center-Freq={1}, Release-Time={2}", bandwidth, centerfreq, beat_rtime)
End If
float bandwidth = 0f;
float centerfreq = 0f;
float beat_rtime = 0f;
if (BassFx.BASS_FX_BPM_BeatGetParameters(stream, ref bandwidth, ref centerfreq, ref beat_rtime))
  Console.WriteLine("Bandwidth={0}, Center-Freq={1}, Release-Time={2}", bandwidth, centerfreq, beat_rtime);
See Also