The bpm finder is here...

Started by bigjim,

bigjim

Heres my port of the soundtouch bpm finding routines ported to a DLL.

This is only the first version and I would be surprised if theres no bugs- however the delphi and vb examples both work perfectly as they are and the results are comparable to the results Ive gotten from traktor DJ.

Theres always room for improvement so if you have any suggestions my email is in with the dll, examples and executables in the package.

I put up a quick page here:
www.ingenious.demon.co.uk

Have fun

Olego

Looks neat, and works fast.  I'm amused that it couldn't decide on many of my songs.  But that's because some of my music is beatless.  :P

~Olego~

fredvs

:laugh: ;D :D Great, i go direct see.  :laugh: :idea:

bigjim

It gets most of my tunes Olego but thats cause most of mine are spanish rave, hhcore, dance, trance or techno.
ie- Dj Sammy Heaven (Radio Edit) Perfect BPM id, however DJ Sammy Heaven (CandleLight Mix) Undecided BPM. If you know the two mixes youll see what I mean. Thanx for tryin my conversion.

fredvs

;D ;D Houra, it works perfectly. :laugh: :laugh:

But to use it with Delphi3 you must change all the functions with no argument, like Get_BPM

Function Get_BPM() :single;stdcall; External 'bpmf.dll';
with
Function Get_BPM :single;stdcall; External 'bpmf.dll';

Also in your sample, i got a range check error :

  for i := 0 to 4096 do // Convert to 4096 of mono data
    begin

      samples := (buffs[j] + buffs[j+1]) div 2;
      j := j + 2;
    end;

if i change with
 for i := 0 to 4095 do
it works perfectly  (???).

Thanks, Bassstillthebest.
 

fredvs

One question more :
///////////////
 retcode := Init_BPM(100, 200); // Inititalize the BPM object with 100 min-bpm & 200 max-bpm
///////////

I dont understand that function, if i change to
 retcode := Init_BPM(80, 200);

I receive totaly others BPM, why ?

fredvs

I pass all night with your bpm.
With 1000000 bytes, it is enough to find the beat.
(quick to load before playing)

But, unforgently, it crashes sometimes the program, any idea, i free well after loading but it crash after +- 10 songs ?

bigjim

I use delphi 4, and I didnt have to change to function get_bpm(), etc but I will fix this in future.

QuoteI dont understand that function, if i change to
retcode := Init_BPM(80, 200);

I receive totaly others BPM, why ?

The value should not be totally different but more precise as you are clarifying the range that the music could possibly be... however I will look into this.

Also:

QuoteBut, unforgently, it crashes sometimes the program, any idea, i free well after loading but it crash after +- 10 songs ?

I'm not sure but I will try to reproduce the error- it could have something to do with the buffers in the dll as c++ does not check whether you write data past the end of an array and you can end up corrupting parts of memory in your program or other programs.

So I'll check through and see if I can correct these problems.

fredvs

Hello Jim

Your dll is perfect, :D no more crash (with application.ProcessMessages and 1.000.000 bytes buffers)

I m wondering of your job.  Thanks a lot (strange that i was just looking now for a bpm finder and you just come with it one week later).

fredvs

Hello Jim again.

About :

Quote:I dont understand that function, if i change to
retcode := Init_BPM(80, 200);

I receive totaly others BPM, why ?  
 

The value should not be totally different but more precise as you are clarifying the range that the music could possibly be... however I will look into this.

Sorry but for songs < 100 bpm, it gives me 2x the bpm, and if i change the range (70,200), for songs bpm > 100 the result is different... :-[

bigjim

I'm still looking into those problems but sometimes with songs at 140bpm or thereabouts it gives about exactly half the bpm(ie 70.43BPM). I think this isnt exactly todo with the speed of the song- but the accents on the beats ie each second beat might be recognised as a beat as theres a big clap on it and the main beat isnt caught at all: I'm looking into solving this..

Also- yes you can grab the bpm after a few bars- but if your first set of the song hasnt got a beat your in trouble and youll get a bad value.

Traktor sometimes gives me half the BPM value and on the Traktor 2.0 theyve recognised this and added at 2.0X bpm button- which I really think you should add just for safety.

If you keep a check on www.ingenious.demon.co.uk Ill be posting the code for a traktor style waveform display- beatmatching system and so on. All free code as I see alot of similar qeustions are asked on here.

Just a tip- if you wish to visulaize a waveform for a certain set of samples: pick the highest and lowest value from that then visualize..Never mind I'll be posting shortly cause this and a few more questions I couldnt find answers for.

fredvs

I see only your dll with the beat-counter..., not a stretching sample...  ???
Perhaps, i have to waitalitle bit... ;)

vertex

#12
interesting...
have a song here (ebm/straight teccno). the vb-example gives me 64.xxx bpm (wich is exactly the half of the original bpm´s - thats ok)
the precompiled delphi sample gives me the message: 'Couldnt decide'

funy ;o) i didn´t look at the codes, because c/c++ is my native... but how can this happen? ;o))

cheers,
vertex


dw

Thanks for the work. It works very well for me, however, when I change the code (Delphi) to replace the "if opendialog.Execute = true then ..." to a specific filename, it fails.