pouët.net

Go to bottom

Where should i start?

category: code [glöplog]
minifmod* I Hate my keyboard :D
2 main things I learned about sync:

1. Don't drive your time from the system clock. Drive it from the audio. You don't care about real time, only the time according to the song. Most audio players will have currentSampleTime or whatever that gives you the time (in seconds) from the start of the track.

2. Don't use seconds. Seconds are irrelevant, all that matters is the beat you're syncing to. 1 beat = 1 unit of time.

The best way I found to deal with the difference in time (in seconds) you get from the audio player and the time (in beats) that you need is just to find the BPM for the track (and strangle the musician if they change it in the middle :) and divide the time by it. Simple example:

timeInSeconds = getSampleTime(); // lets call it 10s..
demoTime = timeInSeconds * (120/60); //120bpm. Demo time = 20 beats

Then all you do is flash the screen white every 4 beats or whatever, and you have your sync.
added on the 2012-02-01 01:53:50 by psonice psonice
Quote:
Rez: Yeah, minifmos it's prety good, but unfortunately i can't find anywhere some kind of tutorial or reference manual about it, only about the Fmod one :/

Wasn't there an extremely detailed description of every function right in the minifmod headers?
Oh and don't use FMOD if you want proper sync, in case it hasn't been said already.
blacksheep8bit: You'll want to use BASS, not FMOD. http://www.un4seen.com/
added on the 2012-02-01 09:30:59 by gloom gloom
gargaj: hahahaha, you fell for bitnaughty's pisstake and replied seriously!!!1
(it was a joke, right?)
added on the 2012-02-01 10:17:58 by smash smash
poe's law.
added on the 2012-02-01 10:22:31 by Gargaj Gargaj
Quote:
blacksheep8bit: You'll want to use BASS, not FMOD. http://www.un4seen.com/


and that is because FMOD has timing issues which BASS doesn't have, causing your demo's sync to suck no matter how hard you try.
added on the 2012-02-01 10:27:48 by skrebbel skrebbel
smash, do you remember at the first Sundown someone was arguing with you about Amiga OS being better than Windows? I believe that is bitnaughty...
@psonice: speaking about that, I still have big problem to synch my effect on V2M music :'(

someone knows if V2 provide his own "currentSampleTime" to be perfectly synched with the music? :(
added on the 2012-02-01 12:01:40 by rez rez
No it wasn't a "pisstake" smash (though I don't fully understand what the word means), I was perfectly serious - why would you think otherwise? When *I* was 15, I had a Spectrum! Why should today's kids have it that different?


...and yes, I was at the first Sundown parcelshit, but I don't think I could have argued that - Amigas didn't make their way to India, matter of fact the 1st time I SAW an Amiga was at that Sundown.
Quote:
When *I* was 15, I had a Spectrum! Why should today's kids have it that different?


Because it's 2012 and not 1984?
added on the 2012-02-01 14:05:22 by okkie okkie
You sure have weird reasoning, son..
added on the 2012-02-01 14:06:07 by okkie okkie
He probably also thinks nobody under 25 should have a mobile phone either :(
added on the 2012-02-01 16:04:39 by msqrt msqrt
bitnaughty: Bah, rasterizing in mode 13h is too easy. When I was negative eight years old we had no frame buffers or even a whole page of RAM and we still managed to draw cubes.

BlackSheep8Bit: I'd extend styx^hcr's suggestion and say "try to get something submitted for revision". Maybe they'll have a firstro compo?
I agree with the "use current beat to drive effects" sentiment. Works even better if you're using a tracked player and have access to its beat counter and/or can get some kind of callback.
added on the 2012-02-01 16:17:45 by Tjoppen Tjoppen
bitnaughty, well it would appear that having no understanding of something doesn't stop you expressing strong opinions about it (eg. C++)
okkie - what's the "son" for?
I'm afraid that it doesn't mean he's your long lost father.
added on the 2012-02-02 08:31:28 by msqrt msqrt
BB Image
added on the 2012-02-02 12:48:15 by gloom gloom
rez: Never looked into libv2.h, have we? See, that's what separates us real coders from you half decent guys :P

Code: // gets sample-exact and latency compensated current play position signed long __stdcall dsGetCurSmp();


JSYK.
added on the 2012-02-02 12:54:45 by kb_ kb_
BURN.
added on the 2012-02-02 13:03:57 by gloom gloom
I was helping out at one of Europe's biggest fetish parties once and my job was the Burn Slave. It was boring. Hung out on Facebook instead. (talk about having seen everything)

And yes, I second everyone except bitnaughty. As important at knowing the fundamentals of basically everything is, it's not really fun. So start with using whatever API you like and do something. And as soon as you're not content anymore with everything below the API layer being magic (eg. because the magic stuff doesn't do what you want :), then read the Abrash book or essays about how GPUs work. But put fun first. The good thing about experience is that it comes automatically in the process. :)

(And to reiterate my in-joke with Rez in a more serious fashion: If you're using APIs or middleware or whatever, opening the header files for reading them is definitely helpful. Good code documents itself and such. :)

added on the 2012-02-02 13:13:46 by kb_ kb_
Quote:
Then all you do is flash the screen white every 4 beats or whatever, and you have your sync.


I'm tired of this kind of flash-sync. Can be ok to fill the last 10 bytes in a 4k...
My current approach is quite different:

1. Get the music sheet (it comes for free in 64k intros as we need to generate music). You need to get the exact time for each note.

2. Compare the current time with the times in the music sheet (so you know what comes next, what has just be played, etc.)

3. Generate the effects and animations based on this information.

One obvious benefit is that the BPM can change at any time, in any way. Depending on you play the music and which tools use the musician, this approach might require some work, though.

Of course, there's no perfect solution - it depends on which kind of effects you want.
added on the 2012-02-02 14:29:04 by LLB LLB
dear fully-potential @kb_:

I found our old subject about that and tried it again yesterday night, and it seems to work with dsGetCurSmp();

Btw I still have a little problem to convert what dsGetCurSmp(); into cute little seconds, I did something who seems to be pretty accurate:

Code:timer_music=(float)dsGetCurSmp()/(float)(44100*4)+timer_buffer;


yes, it's 44100 * 4, don't ask me why, I do not understand myself :D

added on the 2012-02-02 14:34:26 by rez rez
Could it stand for 2 channels x 16 bits per channel ? Naaaaaah
added on the 2012-02-02 14:40:46 by p01 p01

login

Go to top