libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay.DetectBPM Method

Detect beat-per-minute of current stream.

Visual Basic
Public Function DetectBPM(ByVal Method As TBPMDetectionMethod) As Integer
Parameters 
Description 
ByVal Method As TBPMDetectionMethod 
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.Show("This can take some time! Continue ?", "Detecting BPM", MessageBoxButtons.YesNoCancel) = System.Windows.Forms.DialogResult.Yes Then
  Dim BPM As Integer = 0
  BPM = player.DetectBPM(TBPMDetectionMethod.dmPeaks)
  MessageBox.Show("BPM: " & System.Convert.ToString(BPM), "Detected BPM", MessageBoxButtons.OK)
End If
Copyright (c) 2010. Zoran Cindori - All rights reserved.

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

Email: zcindori@inet.hr