it's useful to get the EAP (enhanced audio plugin).
THis can return the length in bytes of a sample.
say your tune is 2 minutes long, and you cut it to ensure that the first beat falls at 0 seconds, and it's 200bpm you know that there will be:
120*200 beats in your tune. (length of track * BPM)
lets call that X
now, using EAP you can get the length of the sample. lets say thats 50000 bytes.
you can now work out 50000/X
this is how many bytes there are in 1 beat.
By doing it this way you wont have to write new code if you want to change the BPM. I recently made a music application that does just this, but as I am not the owner of the IP I cannot post it up here.
If you need any help though, drop me an email.
I want robotic legs.