Exporting a LiveCode App with Audio
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 4
- Joined: Wed Nov 02, 2011 11:01 am
Exporting a LiveCode App with Audio
Hi,
I've developed a very simple animation which includes audio in LiveCode 5.0.
I've deployed the app to an iPad and despite the audio playing OK on my desktop, it will not work on the iPad. It could be with the type of sound file I'm using. The file was embedded into the stack as a .wav.
I've tried to convert it to an aiff file format and will test to see if that works.
Has anyone had any similar issues or does anyone know how to sort this? I see that LiveCode doesn't support mp3.
Regards,
Steven
I've developed a very simple animation which includes audio in LiveCode 5.0.
I've deployed the app to an iPad and despite the audio playing OK on my desktop, it will not work on the iPad. It could be with the type of sound file I'm using. The file was embedded into the stack as a .wav.
I've tried to convert it to an aiff file format and will test to see if that works.
Has anyone had any similar issues or does anyone know how to sort this? I see that LiveCode doesn't support mp3.
Regards,
Steven
Re: Exporting a LiveCode App with Audio
Hi Steven,
the trick is to keep ALL of your sounds as SEPARATE files, since iOS does not support "play ac XYZ" with internal/imported sounds!
If you keep them inside of your application package you can access then via:
specialfolderpath("engine")
WAV should also work on iOS, but AIFF, MP4 or MP3 might be better.
Yes, on iOS MP3 is supported with PLAY...!
Best
Klaus
the trick is to keep ALL of your sounds as SEPARATE files, since iOS does not support "play ac XYZ" with internal/imported sounds!
If you keep them inside of your application package you can access then via:
specialfolderpath("engine")
WAV should also work on iOS, but AIFF, MP4 or MP3 might be better.
Yes, on iOS MP3 is supported with PLAY...!
Best
Klaus
Re: Exporting a LiveCode App with Audio
Hi Klaus, I am working with Steven on the animations.
I have Imported as control the file sound.mp3 and then tried to get it to work with the line
play audioclip specialfolderpath ("engine")&"/sound.mp3"
I can hear a click but no other sound is played. Again if I just change the line to play audioclip "sound.mp3" I just hear the click and no sound. Aiff and wav files play ok using the play audioclip command but not mp3's.
We are using OSX.
I import all sounds individually using the Import as Control command. Should I be importing them in some other manner?
Also, is there a way of deleting audio files that are embedded within a livecode program?
Many thanks
Allan
I have Imported as control the file sound.mp3 and then tried to get it to work with the line
play audioclip specialfolderpath ("engine")&"/sound.mp3"
I can hear a click but no other sound is played. Again if I just change the line to play audioclip "sound.mp3" I just hear the click and no sound. Aiff and wav files play ok using the play audioclip command but not mp3's.
We are using OSX.
I import all sounds individually using the Import as Control command. Should I be importing them in some other manner?
Also, is there a way of deleting audio files that are embedded within a livecode program?
Many thanks
Allan
Re: Exporting a LiveCode App with Audio
Hi Allan,
big misunderstanding
You can NOT play imported (as control) sounds on iOS, you need to use and play EXTERNAL files!
So add your sounds via the "Copy files" Tab in the standalone builder and then you can access them via:
play (specialfolderpath("engine") & "/sound.mp3")
## No keyword "audioclip" on iOS!
Problem is that iOS CAN play MP3 but the IDE on the desktop does NOT!
Deleting sounds:
Go to the LiveCode preferences -> Application Browser and check "show audio clips"
They will then appear in the AB you can delete them via right-click there.
Best
Klaus
big misunderstanding

You can NOT play imported (as control) sounds on iOS, you need to use and play EXTERNAL files!
So add your sounds via the "Copy files" Tab in the standalone builder and then you can access them via:
play (specialfolderpath("engine") & "/sound.mp3")
## No keyword "audioclip" on iOS!
Problem is that iOS CAN play MP3 but the IDE on the desktop does NOT!
Deleting sounds:
Go to the LiveCode preferences -> Application Browser and check "show audio clips"
They will then appear in the AB you can delete them via right-click there.
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 4
- Joined: Wed Nov 02, 2011 11:01 am
Re: Exporting a LiveCode App with Audio
Thanks for your great help. All is working fine now after doing what you said.
It is a pity that LiveCode doesn't support mp3's but hey, it's working!
Thanks again!
It is a pity that LiveCode doesn't support mp3's but hey, it's working!

Thanks again!
Re: Exporting a LiveCode App with Audio
Glad I could help!
Best
Klaus
Best
Klaus
Re: Exporting a LiveCode App with Audio
Hi, I know this post was a while back but I have the same problem with Android. I tried the same solution, but it did not work. How do I import audio to play on Android?
Re: Exporting a LiveCode App with Audio
Hi,
You DON'T IMPORT SOUND FILES into a mobile app. Instead, you save the files together with your standalone, i.e. next to your standalone, as separate files, and you use the play command with a path to the sound file. The path to the sound file should be
but the path may be different, depending on where you store the files exactly.
Kind regards,
Mark
You DON'T IMPORT SOUND FILES into a mobile app. Instead, you save the files together with your standalone, i.e. next to your standalone, as separate files, and you use the play command with a path to the sound file. The path to the sound file should be
Code: Select all
set the itemDel to slash
put (item 1 to -2 of the effective filename of this stack) & "/filename.mp3" into myPath
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Exporting a LiveCode App with Audio
I tried it but it didn't work. After "put (item 1 to -2 of the effective filename of this stack) & "/filename.mp3" into myPath" do I just "play audioClip "filename.mp3" ". Also what is myPath exactly?
Re: Exporting a LiveCode App with Audio
Hi,
You path is:
where you have to replace filename.mp3 with the actual name of your file (obviously).
As I wrote, you use the play command with the path, not just the filename. Which means that
is just plain wrong but
would be correct.
Kind regards,
Mark
You path is:
Code: Select all
(item 1 to -2 of the effective filename of this stack) & "/filename.mp3"
As I wrote, you use the play command with the path, not just the filename. Which means that
Code: Select all
play audioClip "filename.mp3"
Code: Select all
play audioClip (item 1 to -2 of the effective filename of this stack) & "/filename.mp3"
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Exporting a LiveCode App with Audio
Thanks for the response, but this also did not work on the Android phone. Is the path the path of the audio on the computer or on the phone? If its on the phone how would I find that path?
Re: Exporting a LiveCode App with Audio
Hi ...,
(item 1 to -2 of the effective filename of this stack) & "/filename.mp3"
or
specialfolderpath("engine") & "/filename.mp3"
Mark
(item 1 to -2 of the effective filename of this stack) & "/filename.mp3"
or
specialfolderpath("engine") & "/filename.mp3"
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode