Howlernator wrote:Hiya Folks,
Just sharing a tiny bit of love here....that has replaced oodles of complexity with attempts at, callbacks that don't work in loop mode, custom timers etc...
If you have a bunch of audio samples that you want to trigger from a single event, and would like them to playback in time, it's hard, as you cannot actually issue a simultaneous 'start' command to multiple player or audioclip objects.
So, a simple workaround... for those who come after me....
Code: Select all
on playLoopSounds
start player "Player 1"
start player "Player 2"
set the currentTime of player 2 to the currentTime of player 1
start player "Player 3"
set the currentTime of player 3 to the currentTime of player 1
start player "Player 4"
set the currentTime of player 4 to the currentTime of player 1
start player "Player 5"
set the currentTime of player 5 to the currentTime of player 1
end playLoopSounds
...works pretty nicely here, is not tooo noticable on playback, and SHOULD scale ok on different processors etc...
you can also trigger this command sequence with offset calcs to handle beat displacement in audio samples as well....one for the musicologists!
I'd love to hear about others techniques /attempts at solving this one...
regards,
Anthony.
Anthony,
As a total noob to Live Cube (but not to programming), how would I implement the above code in an actual example?
Using one of the tutorials, I created three buttons (PLAY GROOVE 1, PLAY GROOVE 2 and STOP). I would like to do the following:
1) Play sound 1
2) Play sound 2
3) stop them.
Now, I can play sound 1. When I press the button for sound 2, sound 1 stops playing. I need it so that when I press sound 2, BOTH sound 1 and sound 2 play together.
Also, how do I keep them synced REGARDLESS of when I press the button (so they are always in sync). Both sounds are identical in size and tempo (2 bar grooves).
Here is the code for button 1:
on mouseUp
Play audioClip "c:\samples\loops\series1\Drum_Groove.wav" LOOPING
end mouseUp
And for button 2:
on mouseUp
Play audioClip "c:\samples\loops\series1\groove.wav" LOOPING
end mouseUp
It should be noted that the following works perfectly and the two sounds play in sync and loop perfectly:
on mouseUp
Play audioClip "c:\samples\loops\series1\Drum_Groove.wav" LOOPING
Play audioClip "c:\samples\loops\series1\groove.wav" LOOPING
end mouseUp
Thank you for your help.
Mike