Page 1 of 1

Playing Sound

Posted: Tue Nov 19, 2013 3:37 pm
by marcelloe
I have went through the lesson on playing sounds. In the article it says it is picky to play sounds. I have tried wav, mp3, and aiff files with no luck. I also, have uploaded the sound file to the stack. What am I doing wrong?

on mouseUp
play audioclip "sound.wav"
end mouseUp

Re: Playing Sound

Posted: Tue Nov 19, 2013 4:12 pm
by Klaus
Hi Marcelloe,

is this on the mobile platform (iOS/Android)? Please always add this info!
If yes, then this does not work at all, since on the mobile platform
Livecode does NOT play internal/imported sounds!


Best

Klaus

Re: Playing Sound

Posted: Tue Nov 19, 2013 4:21 pm
by marcelloe
Yes, it is for IOS. Sorry I thought I put that in. So, there is no way to add sound, even if I add the sound file to the stack. Can you explain further. In the lesson they talk about playing sound on mobile devices.

Thanks for your help

Mark

Re: Playing Sound

Posted: Tue Nov 19, 2013 4:27 pm
by Klaus
Hi Mark,

yep, "internal" sounds cannot be palyed on iOS.
But then simply use external files :D

Example 1:
1. you have a sound file "sound.wav"
2. in the standalone builder settings "Copy files", add this (and other) file(s)!
3. Then you can access that files with this specialfolderpath():
...
play (specialfolderpath("engine") & "/sound.wav")
...

Example 2:
You have some more sound files in a folder named "sounds" and
you added that complete FOLDER in the standalone builder, you can access
the sounds inside of this folder:
...
play (specialfolderpath("engine") & "/sounds/sound.wav")
...
You get the picture :D


Best

Klaus

Re: Playing Sound

Posted: Tue Nov 19, 2013 4:39 pm
by marcelloe
Klaus:

Thanks for explaining that for me.

Re: Playing Sound

Posted: Tue Nov 19, 2013 4:58 pm
by marcelloe
This is the script I used, but I can't get it to work on my ipad. Not sure what I am doing wrong. I added the files in the standalone "copy files" section.

on touchEnd
play (specialfolderpath("engine") & "/sound.wav")
end touchEnd

Re: Playing Sound

Posted: Tue Nov 19, 2013 5:07 pm
by Klaus
Hi Mark,

I am not sure if iOS supports WAV files!?
Try MP3 or M4A, that should work!


Best

Klaus