how to write a beat matching code with BASS ?

Started by dman10001,

dman10001

Hi, I am using visual studio 2005 C#.

I would like to know how to write a beat matching with BASS
  
Is there a function in BASS to sync channels?
I know I would have to find the high peaks in the audio
but how is this implemented

Please help..

radio42

No, there is no 'out-of-the-box' function available. So I guess you need to implement this all by yourself.

However, a general aproach could be to use the BASS_FX addon and to 'save' all the beat positions e.g. by using the "BASS_FX_BPM_BeatDecodeGet" function.
During playback of two tracks you then would need to calculate the difference between the current position and the next beat position for both tracks and try to calculate an approximate temporary tempo change.
This assumes, that you are also using tempo channels via the "BASS_FX_TempoCreate" function.

dman10001

Thank you for the response, I will try that. It will be a little difficult to write the code.   

RevG

You will have to do more than just let BASSFX BASS_FX_BPM_BeatDecodeGet detect all the beats. You need to use the beats per minute in conjuction with the duration of the song to determine approximately how many beats there will be throughout the entire song. Use that information to create a beat grid. It is obviously very important that the BPM is detected accurately so you will need to allow your users to modify this becuase I find that the BPM detector is not accurate enough.

Then you need to align that beat grid to the rythm. The trick is to find a beat that you know for sure is a "rythm" beat. Then calculate "which" beat that is and count backwards to determine where the "first beat" is. Now align your beat grid to that first beat position. You can use some code to check to see if any beats around it are in the correct spots based on the bpm/duration to determine if it is indeed a "rythm" beat.

You will know when you have it correct if you draw a scrolling waveform and overlay your beat grid on top, because when you tap your finger to the beat you should see the beat line cross the "current heard position" everytime you tap your finger.

Once you have the beat grid created then you will have to write some code to match up two song's tempo/pitch and then position them so that they are in phase. Keep in mind that the songs will drift out of phase if you didn't account for any dynamic tempo change that may have occurred in either song. This is something that is very difficult to account for.

This is not an easy task and 99.9% of all the big boy DJ software companies purchase a system that does this from a third party company because it is so difficult to do accurately and efficiently. That third party company is here http://www.zplane.de/. It's not cheap, but it's not unreasonable at all for what it does.


dman10001

Thanks RevG. I will try to write my own code from what you have wrote.
nice website.
I have some help from a free program online.