Index | adionSoft

BPM Detection Library

about | download | documentation | news | license | contact

Functions

void *BPM_Create()
This function creates a bpm detection object that can be used to detect the bpm for one stream. If you want to detect the bpm from multiple songs or sources at once, it is possible to create more than one bpm detection object.

void BPM_Destroy(void *bpm)
This function cleans up the bpm detection object. After this function has been called you cannot use the pointer anymore.

void BPM_AddSample(void *bpm, float sample)
This function needs to be called for each audio sample of the audio you want to detect the bpm from. If your input is stereo, you only need to pass either the left or the right channels, or the average of the channels. The expected format are samples between -32767.0f and +32767.0f

double BPM_getParameter(void *bpm, int parameter)
This function allows you to receive input from the bpm detection object, such as the detected BPM and the accuracy of the result. See the BPMParam enum for more information about the possible parameters.

void BPM_setParameter(void *bpm, int parameter, double value)
Some parameters can be altered to optimize the bpm detection.
See the BPMParam enum for more information about the possible parameters.

double BPM_getFFTParameter(void *bpm, int parameter)
This function gets some parameters of the FFT that is used.
See the BPMFFTParam enum for more information about the possible parameters.

void BPM_setFFTParameter(void *bpm, int parameter, double value)
Some parameters can be altered to optimize the bpm detection.
See the BPMFFTParam enum for more information about the possible parameters.

void BPM_Register(char *email, char *code)
If you have a registration code for the bpm detection library, you have to pass it to this function at the start of your program, before creating any BPM detection objects. When this function is successfully called, you will not get any shareware notices anymore.

Parameters

BPMFOUNDBPM
Returns the current Beats Per Minute value.

BPMNROFBEATS
Returns the accuracy of the result. If this is less than 16, the result can usually not be trusted. If it is larger than 50, the result will be quite accurate.

BPMBEATLOOP
Returns a number that counts up to 4 to indicate the current beat. If you want to know when a beat occured, just compare the current beatloop value with the previous beatloop value. When it has changed, a beat has occured.

BPMRESET
If you want to use the same BPM Detection object again to detect the BPM for a new song, you can call BPM_setParameter with the BPM_RESET parameter to reset the object and restart bpm calculations.

BPMMETHOD_WAVELIST
Use this with BPM_setParameter to enable the use of the wavelist algorithm to detect BPM. This can be useful for detecting BPM of more difficult songs (Breaks, Rock, ...)
Pass value 1 to enable, value 0 to disable

BPMMETHOD_STRIPES
This is another method that you can activate as an additional algorithm to detect the BPM.

BPMFFT_WINDOWSIZE
The FFT windowsize should not be altered with the current version of the bpm detection algorithm. This is for testing purposes only.

BPMFFT_NBWINDOWS
Sets the number of FFT windows to use. Default is 2. You can use 1 to slightly decrease the CPU usage, but this is will also significantly reduce the accuracy of the result. You can use 3 or 4 for slightly better results, at the cost of more CPU usage. The maximum you can specify is 16, although this will probably not lead to better results. Usually the default will be fine.

BPMFFT_WINDOWTYPE
The default value is 1, which should give the best results. If you want, you can experiment with windowtype 0, although I have not found a case where it gives better results.

BPMFFT_SAMPLERATE
By default the library expects samples to come from a stream with a samplerate of 44100 Hz. If the samplerate of the source is different, use BPM_setFFTParameter to set the samplerate of the bpm detection object to the correct source samplerate.

Usage

You should check the examples included to see how to use the library.
Please note that the examples make use of the FMod Ex sound library, but that the BPM Detection Library can work with other libraries as well, or even with your own audio decoding code.
If you do decide to use the FMod Ex sound library in your project, make sure to check out http://www.fmod.org for the licensing details of the FMod library.

C/C++
You have to add bpmDetect.lib to the linker input of your project, and add bpmDetect.h to your project to use the bpm detection functions.
bpmDetect.dll has to be in the same path as the executable that uses it.

Visual Basic 6
You have to add BPMDetect.bas to your project, and make sure that bpmDetect.dll is in the same path as the executable.
Due to a problem with using callbacks in Visual Basic, if you want to use FMod you either have to compile the project to P-Code and use the callback as shown in the example, or you can compile to Native Code, and use the bpmDetectFmodHelper.dll that is included with the visual basic examples.

Delphi
Use BPMDetect.pas

C#
Add BPMDetection.cs to your project. This will wrap the dll functions in a class. Simply create an instance of a BPMDetection object and use it's member functions.

-

| (c)2002-2007 Adion | Hosted by DreamHost |