Getting into LiveCode for iOS? Ask your questions here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
doobox
- VIP Livecode Opensource Backer

- Posts: 284
- Joined: Tue May 24, 2011 11:47 pm
Post
by doobox » Sat Jul 02, 2011 10:22 am
Hi there,
I am struggling to get a sound file to play in ios.
I am using TM|Audio to import a sound file to the stack (main).
Then the following code to play:
Code: Select all
on mouseUp
play specialFolderPath("engine") & "tm_btn_mech_03.wav"
end mouseUp
when i build for ios i get no warnings... but when i try a build for osx to test, i get this warning:
1 Could not auto-detect inclusions or security categories because stack is password protected
Yet on osx i can get the sound to play..?
Kind Regards
Gary
https://www.doobox.co.uk
-
Klaus
- Posts: 14182
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sat Jul 02, 2011 11:26 am
Hi Gary,
you need ot put parenthesis around concatenated pathnames (and other thing, too)!
AND you need to add a SLASH, since "specialfolderpath" does NOT return a trailing slash!
...
## This will do:
play (specialFolderPath("engine") & "/tm_btn_mech_03.wav")
...
But I''m not sure if iOS can handle WAV files?
Best
Klaus
-
doobox
- VIP Livecode Opensource Backer

- Posts: 284
- Joined: Tue May 24, 2011 11:47 pm
Post
by doobox » Sat Jul 02, 2011 11:50 am
Hi there,
Thank you for that. Year i missed the forward slash.
works at the moment like this:
Code: Select all
play specialFolderPath("engine") & "/Vertigo Sounds/tm_btn_mech_03.wav"
But that was resorting to including the file in standalone setup > copy files.
Cant find the path to a file imported into the stack. That ends up in the AudioClips.
Is there a folder created in the bundle called AudioClips at build time..?
Kind Regards
Gary
https://www.doobox.co.uk
-
Klaus
- Posts: 14182
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sat Jul 02, 2011 12:14 pm
Hi Gary,
ah, I see, sorry, misunderstood your problem.
Well, I'm afraid you're out of luck, since currently imported sounds are not supported on iOS!
You will need to copy all (or all used) sounds into the standalone via the "Copy files" tab in the
standalone builder and then access the sound like in the script above.
Best
Klaus
-
doobox
- VIP Livecode Opensource Backer

- Posts: 284
- Joined: Tue May 24, 2011 11:47 pm
Post
by doobox » Sat Jul 02, 2011 12:24 pm
Ok, Thank you Klaus.
It's not that big of a deal to do that, now i know. Cheers.
Kind Regards
Gary
https://www.doobox.co.uk
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Thu Nov 24, 2011 7:51 am
OK I'm totally confused. To play an audioclip I have imported into an IOS app?
So I need to change all my code that reads "play audioclip "thisClip" to something like play specialFolderPath("engine") & "tm_btn_mech_03.wav" ?
Also, I need to reimport all my audioclips into a standalone?
Max
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7390
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Fri Nov 25, 2011 5:42 am
You can't play audioclips that are embedded in stacks in an iOS app. For iOS, all sound files must be on disk and referenced with a file path. The file path is always relative to the engine, so it will always start with specialFolderPath("engine").
The sounds should be included in the Copy Files pane of the standalone settings. You can throw them in loose there, or copy in a whole folder. If you use a folder, then your iOS app will also use that folder in the path, i.e.: specialFolderPath("engine") & "/mySounds/sound.mp3".
Since mobile apps can't use embedded sounds, you'll save a lot of space if you remove the ones you've already imported.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Fri Nov 25, 2011 6:01 am
Thanks, Jacqueline,
Is there any way to export the sounds?
Max
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Fri Nov 25, 2011 6:07 am
In order copy audio files into the standalone maker, do I first need to place them in a special folder called "engine"? to get specialFolderPath("engine") ?
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7390
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Fri Nov 25, 2011 6:27 am
No, you can't export imported sounds. You'll need to use your originals.
The "engine" folder is the one that the standalone builder creates to hold your app. Every file you include will be inside that main enclosing "engine" folder. Don't create one yourself. The easiest way to manage sound files is to put them all into a single folder. Put that folder into the same one that holds your mainstack on disk. In the Copy Files pane of the standalone builder, choose to include a folder and point it to your sounds folder. The copy files pane should then have an entry something like this:
mysounds/*
In your script, the path would be:
specialFolderPath("engine") & "/mysounds/sound.mp3"
I.e.: all your paths will be relative to the engine folder, in a subfolder named "mysounds" just like it is on your hard drive. You can think of the "engine" folder in an iOs app as being the folder that holds your mainstack on disk.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Sat Nov 26, 2011 6:29 am
Thanks again Jacqueline. I guess the ios environment does have it's own peculiarities.
Does anyone know of any tools or clever tricks for extracting audio files from LiveCode? (Possibly re-recording audio being played from a stack? or will ResEdit work?)
Max
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7390
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sat Nov 26, 2011 8:00 am
It isn't for the faint of heart, but there are some clues here:
http://runtime-revolution.278305.n4.nab ... l#a3355426
It would be much easier if you had the original files.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Sun Nov 27, 2011 8:20 am
Third Thanks, Jacqueline.
Yes, I am faint of heart for that procedure.
I did get this sound to play on my Mac, but would not play on my IOS simulator.
play specialFolderPath("engine") & "/Users/macbookpro/Documents/jokesfolder/book.aif"
Can I get sounds to play on my simulator?
By the way, I really think sound files should be as easy to use as everything else is in LiveCode. I mean, look how easy a picture file is to use,edit, delete, blend, add graphic effects, rotate, etc. Quicktime is the only program that Livecode accepts to import an audio file. I've tried Garageband, SoundBooth, Soundtrack pro, to create .wav and .aif files, but they all just screech in Livecode.
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7390
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sun Nov 27, 2011 7:40 pm
The sounds won't play in the simulator because the simulator uses the same file hierarchy as your standalone will use. For that, you must use the file structure I described, where your sounds are in a folder that is relative to the standalone.The easiest way to do that is to put the sounds into a folder that is inside the mainstack's folder. Or you can put the sounds loose in the mainstack's folder if you like. The important part is that the sound files are at the same level or lower than the mainstack.
LiveCode can play any sound format that QuickTime supports. But for an iOS standalone, you should not import the sounds anyway. They need to be on disk.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
maxs
- VIP Livecode Opensource Backer

- Posts: 421
- Joined: Sat Jun 24, 2006 12:02 am
-
Contact:
Post
by maxs » Sun Nov 27, 2011 10:14 pm
I got it now.
Although the directions were clear, it's so easy to make a mistake.
Thanks, Max