libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay.DetectBPM Method

Detect beat-per-minute of current stream.

Pascal
function DetectBPM(Method: TBMPDetectionMethod): Integer;
Parameters 
Description 
Method: TBMPDetectionMethod 
Detection method. See valid detection methods

BPM value. If algorithm can't detect BPM value, return value is 0.

This function will scan current stream and detect beat-per-minute. 

Note: Detection process can take some time. 

Warning: THIS FUNCTION WILL STOP CURRENT PLAYING AND SET POSITION TO 0.  

If you need to detect BPM value without interference with playig stream, use DetectFileBPM function. 

BPM detection algorithm isn't 100 % accurate. Algorithm will stop when first valid BPM value is detected. If BPM value can't be detected, algorithm will try to search whole stream. If this fails, returned BPM value is 0.

if MessageBox(Form1.Handle, 'This can take some time, please wait ! Continue ?', 'Beat per minute detection', MB_YESNOCANCEL) = ID_YES then
    MessageBox(Form1.Handle, PAnsiChar(IntToStr(player.DetectBPM(libZPlay.dmPeaks))), 'Beat per minute', MB_OK);
Copyright (c) 2010. Zoran Cindori - All rights reserved.

Web: http://libzplay.sourceforge.net/

Email: zcindori@inet.hr