cjcliffe / beatdetektor

BeatDetektor BPM detection / visualization library
http://www.beatdetektor.com
324 stars 54 forks source link

C# Port what am I doing wrong? #7

Closed ItsEcholot closed 9 months ago

ItsEcholot commented 8 years ago

First, thanks a lot for this algorithm. I'm working on a small C# program which should detect the BPM of music coming live trough the sound card (using the WasapiLoopbackCapture function of NAudio).

For this use I tried to port the C++ code to C# and I thought I accomplished this but it doesn't seem to work at all.

What am I doing wrong?

https://gist.github.com/shock2provide/a540026e721396bf3afa2bdabd1c133a

cjcliffe commented 8 years ago

@shock2provide I haven't really used C# enough to know what's wrong from looking at your source; but if you can provide a working demonstration app that uses line-in or microphone I should be able to debug it and let you know what's up.

If it's simple enough I'd be happy to add your port and example to the official repository.

ItsEcholot commented 7 years ago

Alright I had some time to continue my work on this project and I cleaned my port up a bit and fixed a few mistakes... Tough it still doesn't work!

Here is the new code: https://gist.github.com/shock2provide/0af3f7a58f9e012220614078e1cc0372

And this is the code I use to get the fft data: https://gist.github.com/shock2provide/c2502901aac2b33cd44a66ef5a5e1fcd

I basically just run a loop in a backgroundWorker which executes Process() and feeds it a counter which increments with each run trough the loop and the _fftBuffer data from the second code snippet.

What I noticed is that the trigger_gap is always 2... What am I doing wrong?

Kind Regards

cjcliffe commented 7 years ago

@shock2provide I've started using C# for some work projects and am reasonably familiar now; I'll take a look when I can and possibly provide an official port if I have the time.

Cheers!