Copyright © 2005-2019 MultiMedia Soft

How to detect beats positions and BPM

Previous pageReturn to chapter overviewNext page

Audio Dj Studio API for .NET supports both "Beats detection" (BD)  analysis and "Beats Per Minute" (BPM) analysis.

 

"Beats detection" (BD) analysis can be performed in two ways:

 

Offline: in this case beats detection analysis is performed through a call to the BeatsDetectRequest method while the sound to analyze is not in playback status: beats detection is performed in a separate thread and the container application is informed about results being available through the CallbackForPlayersEvents delegate which is invoked with the nEvent parameter set to EV_BEATS_AVAILABLE. At this point you can enumerate available beats positions through the BeatsDetectGetBeatsCount method and to obtain each of them through the BeatsDetectGetBeatPos method. By default beats position analysis will scan the overall sound: a smaller range to analyze can be set through the BeatsDetectSetRange method.

 

Real-time: in this case beats detection is enabled by a call to the BeatsDetectEnableRT method and performed while the sound is in playback status: each time the control detects a beat during playback notifies the container application through the CallbackForPlayersEvents delegate invoked with the nEvent parameter set to EV_BEAT_DETECTED.

 

In both cases, parameters applied to beats detection analysis can be obtained/changed through the BeatsDetectGetParams and BeatsDetectSetParams methods.

 

 

"Beats Per Minute detection" (BPM) is enabled by default and automatically calculated each time a new sound is loaded: the CallbackForPlayersEvents delegate, invoked with the nEvent parameter set to EV_BPM_AVAILABLE, will pass detected BPM to the container application.

 

Automatic BPM detection can been disabled/enabled through a call to the SetAutomaticBPM method: when disabled you can manually request BPM detection through the RequestSoundBPM method: also in this case the CallbackForPlayersEvents delegate, invoked with the nEvent parameter set to EV_BPM_AVAILABLE, will pass detected BPM to the container application.

 

 

Both beats position detection and BPM detection won't work with sounds with more than 2 channels (5.1 or 7.1) or if the EnableMixingFeatures property has been set to BOOL_FALSE.

 

A sample of use of the "Beats detection" (BD) analysis in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package:

- BeatsDetection

 

A sample of use of the "Beats Per Minute detection" (BPM) analysis in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package:

- TestPlayers