This is BMAX code but applies right across the board so I though I'd post here.
I'm using the following code to calculate the BPM on the playing track, it's very accurate when there is a distinct bass drum but becomes erroneus when there is a Sub Bass Line going on. I know the issue is that I'm monitoring just a few frequencies (FFT) at the low end, perhaps I should be looking at mid range also for snares?
Any Ideas? better way to do it? (using bass.dll)
I'm using the following code to calculate the BPM on the playing track, it's very accurate when there is a distinct bass drum but becomes erroneus when there is a Sub Bass Line going on. I know the issue is that I'm monitoring just a few frequencies (FFT) at the low end, perhaps I should be looking at mid range also for snares?
Any Ideas? better way to do it? (using bass.dll)
MAINLOOP BASS_ChannelGetData(Music,Byte Ptr fft,BASS_DATA_FFT512) DoBPM() ENDMAINLOOP
Function DoBPM() If MilliSecs() - secsPrevious < 300 Then Return If IsBeat() secs = MilliSecs() If ((secs - secsPrevious) > 2000) Then Beatcount = 0 If (Beatcount = 0 ) Then BPM = 0 secsFirst = secs; Beatcount = 1; Else BPM = 60000 * BeatCount / (secs - secsFirst); BeatCount :+ 1 EndIf secsPrevious = secs; Return EndIf EndFunction Function IsBeat() For Local f:Int = 0 To 10 If (fft[f] > 0.6) Return True EndIf Next Return False EndFunction