Page 1 of 1

mobileplaysoundonchannel - sequential sounds

Posted: Sat Jun 02, 2012 6:32 pm
by scotttyang
As always, new to the mobile sound concept.... I have been using the typical..

play "sound1.aif"
wait until the sound is done
play "sound2.aif"

but I need to be able to play sequential sounds without the wait command, as the wait pauses the script and everything in the app stops waiting for the sound to play. But I noted that mobileplaysoundonchannel can queue up with the "next", but somehow, all the sounds seems to play together at once as noted in the bottom script for 3 sounds to play sequentially when the prior sound is done.

mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound1.aif","tsounds","next"
mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound2.aif","tsounds","next"
mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound3.aif","tsounds","next"

For example if a child click on a series of pictorial words, the playback button will play back the string of words into a sentence without pauses or waits, but sequentially.

Any ideas will be helpful. this mobile sound channel is new to me

Re: mobileplaysoundonchannel - sequential sounds

Posted: Sat Sep 24, 2016 6:46 am
by DirkArnold
Four years later... I was looking for some guidance on sequential sounds myself, and ran across your question. I figure I'm not the only one, so I will report my findings:

To play the sounds in sequence with mobilePlaySoundOnChannel, put "now" in the first line of your script sample, and "next" in the others. I'm only concatenating two sounds but that worked for me.

My problem is the wait. There doesn't appear to be a mobile equivalent of "wait until the sound is done" but we do have soundFinishedOnChannel. I expected it to fire each time a sound finishes on the channel, but in my case it appears to only be triggered when the first sound finishes. I'm trying to disable a next button until both of my sequential sounds finish, and it's giving me fits.

If anyone has any suggestions about how to capture the end of a sound sequence, I'd love to hear them.

ALSO: For anyone who wanders onto this topic unfamiliar with the mobileXXX commands, here are some tips I've not seen elsewhere:
-- The IDE does not color code the mobile commands.
-- You need to wrap them in an if the environment is "mobile" statement, otherwise the IDE will say it can't find the handlers.
-- To really test the mobile commands, you should generate a mobile standalone. The iOS simulator, at least, is more forgiving than the real thing.

Re: mobileplaysoundonchannel - sequential sounds

Posted: Tue Jan 30, 2018 6:35 pm
by yeldarb
DirkArnold wrote:
Sat Sep 24, 2016 6:46 am
To play the sounds in sequence with mobilePlaySoundOnChannel, put "now" in the first line of your script sample, and "next" in the others. I'm only concatenating two sounds but that worked for me.
I'm making a clock app and want to have the hours chime. I've gotten the "next" attribute to work on the first sound immediately following the "now" sound, but no more. So I can only get two sounds to play at a time. I guess I'll have to mess with the soundFinishedOnChannel and see if I can link the sounds that way. Anyone have any ideas I'd love to hear them.

Re: mobileplaysoundonchannel - sequential sounds

Posted: Wed Jan 31, 2018 7:55 pm
by yeldarb
As I mentioned above, the "next" param only allowed me to append one sound to a "playlist." However, I was able to use the soundFinishedOnChannel command to create a sequence of sounds.

Re: mobileplaysoundonchannel - sequential sounds

Posted: Thu Mar 22, 2018 6:42 pm
by williamdesmet
@yeldarb
Can you put your code here please?
I can't get it to work with soundFinishedOnChannel to create a sequence of sounds.

greetings,

William