Timing Functions

Get help using Construct 2

Post » Thu Jun 21, 2012 6:57 am

Greetings to everyone. I've been testing out this program for a little over a week now, and some of the procedures seem fairly straight forward and others are quite complicated. I am demoing the program as per the claims that no programming knowledge is necessary. I think that possibly the only ones having much success with grasping this software, already have experience in coding. For the right brained folks such as myself we think more easily in terms of physical geometry and spatial relations, yet struggle with complex mathematical and algebraic equations. Without the right brained folks most games would look rather dull. Without the left brained folks your image (no matter how bitchen the sprite is) ...its still just a boring old sprite. Ok this got way to long winded...sorry. I guess I'm trying to say that this I'm quite often very mathematically challenged so forgive me if I'm slow and ask many questions.
Ok now for the biggest question bugging me right now...
How would I go about synchronizing a timer to start when the music actually starts playing? I set a global var for the timer to increase by one every second. however it often starts before the music. I would like to accurately sync events,anims etc. to markers in the audio track. Any help would be awesome. All I really care about is getting the counter to start when the music does.   
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 8:09 am

It's probably one on the most difficult thing to do and understand !

-> Using HTML5, C2 can command to the browser to play a sound.
-> Each browser use if own logic and system to play the sound.
-> Depending on many parameters, the sound can be play immediatly, after a loading/buffering time or not be play at all if browser restricted access to the sound playing feature.
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Thu Jun 21, 2012 1:21 pm

Thank you naelian for your response. I'm hoping that I formed my question correctly. I'm not really as concerned about how long it takes for the music to fully load. I was just hoping that there could be some sort of event or whatever, that will check for when the background music actually starts playing or becomes audible. I have a rather dynamic piece of music that I would like to sync up certain actions to. So That is all I'm hoping for, I tried out a few different methods, with little luck.
The type of games that I'm working on now runs throughout the entire music score. Your player does not die, yet you do not advance unless you meet a score requirement. All I want for Christmas is a way to sync actions and animations to the music. Wonder if Christmas will be in June or July? heee hee.
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 2:08 pm

Ok, in C2 projects generally 2 kinds of sounds are used.

Endless background looping music so no sync problems ;-p
Very short little sound effects so with very short delay problems ;-p
In some browsers it's possible to preload sounds to play them quickly when needed, in others only one sound can be played at a time (avoid those)

You could use several looping musics and put some in "muted" state ... "unmuted" then to play again immediatly but of course not always from the start. It's also possible to control sound level for each sound to create a Fade in/Fade out effect so perhaps changing music "smoothly" depending on actions.

You have no way in C2 to have a sound feedback to know really if a sound is audible, you can just control the sound level of each sound.
naelian2012-06-21 14:10:29
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Thu Jun 21, 2012 2:24 pm

Thank you naelian!
Your last sentence answered my question. That it is not possible for a program to listen for a sound trigger. I will see if any of your workarounds help, or find a new workaround. I really appreciate your getting back with me. I usually decide on whether or not to purchase a program based on the level of support included. Its looking good here so far. Oh and naelian...I like your big green smile! Auntie Val2012-06-21 14:29:08
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 2:36 pm

Oops... naelian... I just re read your response again, and now I have another question. In the first sentance of your reply, you said endless looping music.."no problem". I'm not concerned with the "sounds" triggered upon actions. Just a way to get the counter to start when the background music starts (it only plays through once). For a second there you first sentence began to give me a glimmer of hope.Auntie Val2012-06-21 14:37:39
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 4:12 pm

i guess you best bet is to preload the needed sound, so you sure there's no buffering after you click "play"

when clicked "play" you start the buffered sound and timer, then its just a matter of making timed triggers
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Thu Jun 21, 2012 4:17 pm

Yippy! I figured out a work around. I set the background music to preload at the beginning of the layout. Then I triggered it with a global timer set at about 12 seconds into the layout giving it ample time to preload before called upon. So now the background music is triggered at a precise time. Smaller sound files can fill up the first 12 seconds. I will do my best to see how long the sound will take to load under different conditions. I don't know if twelve seconds is really all that necessary, however it would make a nice spot for some narration or something. I guess when it comes to Christmas in June, sometimes you just have to be your very own best Santa.
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 4:24 pm

Thanks Vtrix! I noticed your help after discovering my work around.
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Jun 21, 2012 7:08 pm

You can use the "Audio: All preloads complete condition" to check when it's done preloading instead of waiting 12 seconds.

I got carried away messing with this...
soundSync.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Next

Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt and 15 guests