Using game clock to match BPM of music clips..
![lbc4ever](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hello all,
I'm working on a game which revolves (quite literally) around music & need to figure out a way to start different loops in time with each other. Each loop has a button & will play when pressed. First off I thought I'd just start them all as soon as the level began at Zero volume then use the buttons to set their volumes from 0 to 1. All nice and synced. Easy. Turns out gamesalad can't adjust a single sounds volume on the fly.. I've spent 2 days trying to no avail.. SO..
My next method was to calculate the time it took for 8 beats at 120bpm (4000ms) and have the audio start at 4 second intervals (ie: at the start of a bar) thus keeping everything timed properly.
My question to you all is this. How do I tell gamesalad to..
1 : Generate a flag every 4 seconds (or more or less depending on BPM of the track)
2 : Delay any instructions to play audio clip until it sees that flag
3 : Start playback the moment it spots it
4 : Apply those instructions to 7 or 8 clips in the same scene
Call me a dope here but I been at this for days.. Tried various combinations of timers, rules and attributes and got no closer to a solution.. Help?
Once we crack it I will put a template up online as BPM matched instructions would be a handy tool for a tonne of different games.
Tanx guys![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Lbc4ever
I'm working on a game which revolves (quite literally) around music & need to figure out a way to start different loops in time with each other. Each loop has a button & will play when pressed. First off I thought I'd just start them all as soon as the level began at Zero volume then use the buttons to set their volumes from 0 to 1. All nice and synced. Easy. Turns out gamesalad can't adjust a single sounds volume on the fly.. I've spent 2 days trying to no avail.. SO..
My next method was to calculate the time it took for 8 beats at 120bpm (4000ms) and have the audio start at 4 second intervals (ie: at the start of a bar) thus keeping everything timed properly.
My question to you all is this. How do I tell gamesalad to..
1 : Generate a flag every 4 seconds (or more or less depending on BPM of the track)
2 : Delay any instructions to play audio clip until it sees that flag
3 : Start playback the moment it spots it
4 : Apply those instructions to 7 or 8 clips in the same scene
Call me a dope here but I been at this for days.. Tried various combinations of timers, rules and attributes and got no closer to a solution.. Help?
Once we crack it I will put a template up online as BPM matched instructions would be a handy tool for a tonne of different games.
Tanx guys
![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Lbc4ever
Comments
2. use that attributes condition in a rule to play another sound
EX: create an Attribute index type playSound#
on actor
Rule: when
Attribute: game/actor.playSound# = 0
--Play Sound:
--Interpolate: playSound# To: 1 Duration 4
(you could use a table for durationTime… and exp. tableCellValue(table,row,col) … but there is no row or column)
Rule: when
Attribute: playSound# > 0
--Rule: when
--Attribute: playSound# = 1
---Play Sound:
---Interpolate: playSound# To: 2 Duration 4 (or whatever the cellValue)
--Rule: when
--Attribute: playSound# = 2
---Play Sound:
---Interpolate: playSound# To: 3 Duration 4 (or whatever the cellValue)
and do an option+drag of those rules to nest them in the > 0 rule … changing the values as needed
@};- MH
That sounds like an effective approach. I will try it this afternoon & report back.
lbc4ever
So far it works great so long as there is only 1 clip in a scene. The 2nd / 3rd etc etc play as soon as you touch their respective buttons regardless of
any rules that I have set up.
Here's how I'm trying to prove the concept..
I have a game control actor (offscreen) containing the PlaySound attribute and the rules to interpolate it to a value of 1
I have 3 game attributes (boolean). Play 1, Play 2 & Play3
I have 3 buttons onscreen that change the above booleans to true when touched
Inside the game controller are rules that state.. When self.Playsound=1 AND Game.Play1=true Play sound x
When self.Playsound=1 AND Game.Play2=true Play sound y
When self.Playsound=1 AND Game.Play3=true Play sound z
Am I missing something?
Lbc4ever
I just needed to tie the clip volume to an actor attribute.
Wally.
Thx for the help MH
thought it was sequential play! … like what you did and, how you got that worked out to sync with touchButtons
@};- MH
ONELOVE