Archived

This topic is now archived and is closed to further replies.

Sync events with positions in a sound file?

This topic is 5117 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am writing a little game which includes a tutorial. The tutorial is basically a sound-file (.mp3) which is played. Now, I''d like to synchronize some events with this file. For example, the sound-file just announces "if you move your mouse-pointer to this icon" and at this precise moment, I''d like to highlight "this" icon... So far, I have done it by measuring the time the mp3-file needs to reach that point and I simply highlighted my icon as soon as the time is up. First, this is ugly, second, it''s going to be _hell_ to translate the tutorial and third, there just has to be a way of encoding time-stamps into an .mp3 (or in fact _any_) sound file, right?! Question is: Do you know any way of doing this? Is there a built-in synchronization feature for mp3-files? Do you know any sound files where this synchronization can be done easily? Thanks in advance, Beren

Share this post


Link to post
Share on other sites
Just have the "hotspots" stored in a data structure. Then get current playing position time and see if any of the hot spots are supposed to fire.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
most tracker formats supports something like this (to synchronize demo events)

Share this post


Link to post
Share on other sites
I did something sort of similar... I simply counted the number of bytes I''d copied into the audio buffer. This was very accurate but it woudl mean couting the actual sample bytes of your breaks in an editing program. I used it only once to get the end of a song, not for breaks so it was quite easy.

Any reason why you can''t use lots of little mp3 files and load and play each one for each lesson? A ''lesson'' class might include an mp3, the text etc. and make the thing easier to translate or edit later.

Mark
Flatspace is coming: The ultimate space adventure
http://www.lostinflatspace.com

Share this post


Link to post
Share on other sites
Thanks for your replies, everbody!

@MOVSW: Yeah, that''s the idea... I hoped that such a feature would already be existing in .mp3 structure, but alas, I will have to do it on my own (let alone writing the editor *brrrr). But I see no other option, so thanks for your advice.

@Mark: Basically, the reason for not using many small mp3-files is that I''d have _lots_ of them (maybe just around 20.000 (that''s twenty thousand)), so I''d probably have too much of an overhead, reading the headers and data from the file system (even more so, since I am using java and not c++ for this particular part of the game).

Share this post


Link to post
Share on other sites