Playing Sound

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Playing Sound

Post 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
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing Sound

Post 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
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Playing Sound

Post 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
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing Sound

Post 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
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Playing Sound

Post by marcelloe »

Klaus:

Thanks for explaining that for me.
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Playing Sound

Post 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
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing Sound

Post by Klaus »

Hi Mark,

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


Best

Klaus
Post Reply