Help With Sound BPM

Blitz3D Forums/Blitz3D Programming/Help With Sound BPM

Neochrome(Posted 2005) [#1]
I have found that on each computer there is a very small deviation of CPU speed ratio to screen refresh rate

Im getting on 1 computer a game perfectly syncronised to the music

on my main computer the game works slightly faster by a millionth of a second and by the end of the song the game is out of sync

how can i solve this??


John Blackledge(Posted 2005) [#2]
The quick but nasty answer is 'SMPTE' - the industry standard means of syncronisation between MIDI, video, file, and audio streams.

I had to battle with it many years ago when I wrtote a midi-sequencer; _not_ nice.

Until Fmod (the Blitz music player) is rewritten to allow absolute tracking (moment-to-moment frame-seeking and reading) I don't think there's any chance of proper syncing of audio to any other media stream or action within a game (which of course would mean that your own 'action' would have to be frame-based).

I've just realised what gobbledy-gook that all sounds.
Any clearer?


Damien Sturdy(Posted 2005) [#3]
SMPTE. *dies* hah.

Its clearer to me, but how does, say,rockstar do it in GTA? they dont use SMPTE ;)


Neochrome(Posted 2005) [#4]
i mannaged a work around at the moment i found that blitzbass.dll appears to work wonderfully at getting the objects to move! basically
smbpm# = (BPM / 60) * (scale of sprite precalcated) + ticks

since all 3d cards are the same internally! 1 unit! as far as i know this wont deveiate!

i looked in to FMOD and their it was!! getTicks or something.. this actually works! so far 2 machines work the same! and they are the same two that gave me problems!!

John Blackledge : this did make sence, after reading that i did some reserch.. nice one dude.


Gygnus : I think the method i used "could" be it???


Damien Sturdy(Posted 2005) [#5]
Maybe, but GTA VC would lose synch if the game got halted.

Using the position of the playback marker is a neat and sometmies easy wat to do it.

BlitzBass or FMod arent free though, so using them if you plan to go comercial could hinder you.

If you want to do it in pure blitz code, measure how long a single sample takes to play and calibrate to it. use this to create your own "getticks" function. :)


John Blackledge(Posted 2005) [#6]
I know that BlitzBass costs, but I thought Fmod was built in Blitz.
Are you using an external version of it?
It never occurred to me that there was such a thing.

Hmmm, this might be something that you could contribute to the Blitz community:
e.g. Get Fmod _here_, and a quick list of likely used internal functions (or maybe a wrapper).

I'm great at suggesting work for other people, aren't I?


Damien Sturdy(Posted 2005) [#7]
Theres already an external Fmod wrapper *somewhere* i'm sure,

The command "GetTicks" isnt part of blitz though....

....MARK! :P ;)


Neochrome(Posted 2005) [#8]
I would love it if mark had a function the GetTicks(channel) function!
problem is, how would i do that in pure blitz though?

could anyone use a dll to hack blitz fmod lib?


Damien Sturdy(Posted 2005) [#9]
As i said above, its possible to figure out Ticks by first seeing how long a 1 second sample takes to play.


thinking about it, not sure how accurate it is in blitz im afraid so it may be useless :/


Neochrome(Posted 2005) [#10]
i did try it that way, and it still deviates on some computers.. i could be something about the SoundCard! so far the blitzbass.dll appears to be accurate enough. But if i was to sell the game id have to pay out too

is the BlitzBass.dll a one payment thinggy cos i could live with that if this game sells good!


LAB[au](Posted 2005) [#11]
Blitzbass is a wrapper for Bass written by Rob Hutchinson, Bass is a library written by Ian Luck http://www.un4seen.com, the licensing is described on his site. By the way there should be a decls for bass somewhere, you shouldn't need to use the wrapper anymore.


Neochrome(Posted 2005) [#12]
would be nice to get rid of the blitzbass wrapper actually, but i dont see the .decls file
Anyone got this file??


LAB[au](Posted 2005) [#13]
Vertex did a decls for Bass which he named BassEx. Otherwise Halo did one (posted on this forum) and there is a Bass18.decls also (author I don't remember). I sended you the halo stuff and this Bass18 by email.


Neochrome(Posted 2005) [#14]
LAB[au] my email is neo32@... just incase you got a bounce back.. cheers for the help :)


IPete2(Posted 2005) [#15]
Neo,

Is this for your dance mat game? I am really interested in this project and how your development is going. Please keep us informed!

IPete2.


Neochrome(Posted 2005) [#16]
I will do iPete2:

im gonna try to keep a work long here http://www.blitzbasic.com/logs/userlog.php?user=833&log=501