How to use Player to play some short audio file (MP3 or WAV)

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

How to use Player to play some short audio file (MP3 or WAV)

Post by alex298 » Fri Oct 16, 2009 6:06 am

Hello,

Platform: Windows

I wish to use RR to play some very short external audio files (MP3 or WAV) for a program. Actually I don't need the Play button, Rewind buttons, Pause button, etc... I just wish to play the audio file like that:

If theNumber = 3 then
## Play the short audio file 3.wav here
end if

I read the Tutorial of Callbacks from RR official website. It seems that Player may be the solution.

Could some experts here provide the guideline for me?

Thanks and best regards
Alex
Nice to meet all of you.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Oct 16, 2009 8:41 am

Dear alex298,

You almost got it right:

Code: Select all

if theNumber = 3 then
  play "path to audio file 3.wav here"
end if
You don't really need a player object here, but if you want to embed the sound file in your stack, you can import them (see File menu) and use the following script:

Code: Select all

if theNumber = 3 then
  play "name of audio clip 3.wav here"
end if
Best,

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

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Post by hliljegren » Mon Oct 19, 2009 11:10 pm

Mark wrote: You don't really need a player object here, but if you want to embed the sound file in your stack, you can import them (see File menu) and use the following script:

Code: Select all

if theNumber = 3 then
  play "name of audio clip 3.wav here"
end if
Best,

Mark
Well, if alex298 wants to play "MP3 or waw" he needs to use a player as the built-in support does not support mp3 (AFAIK)

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Oct 19, 2009 11:13 pm

hliljegren,

Why mp3? Alex seems to be happy with wav.

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

Post Reply