How to play a 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
asw
Posts: 7
Joined: Sun Mar 02, 2014 9:57 pm

How to play a sound

Post by asw » Wed Mar 05, 2014 10:31 pm

I'm going crazy! I had made an app with Community 6.1.1 (rc4) that played all kinds of .wav files in a subdirectory. Now I am using Commercial 6.5.2 and can't play anything at all. I actually imported a sound, "mySound.wav" into my app and then created a button with this on mouseUp command: play audioClip "mySound.wav" and I get nothing at all. And also my old app that DID play sounds now will not play sounds at all. I don't know what happened. I have a vague recollection that I need Quicktime installed, but I do not think I ever uninstalled Quicktime - if I even ever had it on my system.
Thanks very much,
asw

KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Re: How to play a sound

Post by KennyR » Wed Mar 05, 2014 11:05 pm

Question....did you add the .wav file in the application settings/copy files section? You said you created a sub directory and I guess you mean you added the file to the copy files section of the settings....right? So make sure you do the following..

1-add the file to the copy files section of the application settings
2-import the file to stack
3- reference it like so...

on mouseUp

play audioClip "mySound.wav"

end mouseUp

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: How to play a sound

Post by Simon » Wed Mar 05, 2014 11:52 pm

Hi asw,
I just tested this in 6.5.2 and audioClip is working.

Now I'm not being mean or anything, but when you double click the file in Explorer/Finder does it play? (yes, I'm thinking mute). Just that upgrading from one version of liveCode to another wouldn't stop a sound playing that had been playing.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to play a sound

Post by Klaus » Thu Mar 06, 2014 1:50 pm

Hi Larry,

is this on Windows?
As Simon says, if this has been working in 6.1.x then it will also work in 6.5.2!

Unfortunately LC is VERY picky with sound formats when using the "play ac xyz" command.
It only supports e.g uncompressed WAV and AIF files. And the "compressed by nature" AU format.

You could try to use a player object, which requires QuickTime to be installed on the machine to work.


Best

Klaus

asw
Posts: 7
Joined: Sun Mar 02, 2014 9:57 pm

Re: How to play a sound

Post by asw » Fri Mar 07, 2014 12:03 am

OK, here's what I just did. I went to the folder under 6.5.2 where the .wav file is and double clicked it. It opens in Windows Media Player (my default player) and plays. My speakers are on. Then I open my app where I've imported the same file as an audio clip. I open the Application Browser and there is the .wav file showing in AudioClips in my stack. I right click on it and then click "Play" and I get nothing. So I doubt that I am doing anything wrong. I'm using Windows XP, Service Pack 3.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: How to play a sound

Post by Simon » Fri Mar 07, 2014 12:20 am

Hi asw,

I've made a test stack that I've attached, it's working here.

Simon
Attachments
Untitled 1.zip
LC 6.5.2
(191.39 KiB) Downloaded 260 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

asw
Posts: 7
Joined: Sun Mar 02, 2014 9:57 pm

Re: How to play a sound

Post by asw » Fri Mar 07, 2014 12:24 am

I did some more testing and went back and looked at my old app where the sounds were playing. It has to do the the "flavor" of the .wav file. The one that would NOT play was 32 bit stereo. When I changed it to a 16 bit signed .wav file then it plays just fine. Thanks for your replies and now I'm posting this in case anyone else has this particular issue.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to play a sound

Post by Klaus » Fri Mar 07, 2014 9:44 am

As I said, LC is extremely picky with sound file formats :D
It is about time to finally add a new multimedia engine to LC.

Dependence on Quicktime sucks, except on a Mac :D

Post Reply