media.playSound() and media.playEventSound() in Simulator

3 replies [Last post]
duffel
User offline. Last seen 2 years 3 days ago. Offline
Joined: 2 Feb 2010

media.playEventSound() is not working for me in the Corona Simulator with any audio file or format. Does this require a build to work?

media.playSound() is not working for me in the Corona Simulator with the audio files provided in the demos but works with other audio files. I messed around with the demo audio files to get them to work. (see below)

GettingStarted/EventSound_tests & Tutorial/HelloWorld3
- beep.caf won't play back in Corona Simulator
- converting to .aif or .mp3 doesn't help
Fix: make the sound longer than .5 seconds (I added silence to the end of the sound in Sound Studio)
- after fixing the sound works in all formats (.caf, .aiff, .mp3)

Device/CaptureToFile
- CameraShutter.aiff will not play back in Corona Simulator
- tried a minor edit in Sound Studio and resaved as .aif but still didn't work
- other .aif or .aiff files play back fine
Fix: convert CameraShutter.aiff to mp3 in iTunes or Sound Studio

Replies

justkyle
User offline. Last seen 13 weeks 4 days ago. Offline
Joined: 2 Feb 2010

I'm having the opposite problem. I have my sound working fine in the simulator (mp3s 1 - 4 secs long) but they dont play on the iPhone... Any help?

pipID = media.newEventSound( "pip.mp3" )

function playPip()
media.playEventSound( pipID )
end

playPip()

carlos m. icaza's picture
carlos m. icaza
User offline. Last seen 3 hours 57 min ago. Offline
Ansca Staff
Joined: 22 Jun 2009

justkyle

you need to use media.playSound() for mp3's

see page 40 of the AppProgrammingGuide.pdf

Carlos

justkyle
User offline. Last seen 13 weeks 4 days ago. Offline
Joined: 2 Feb 2010

I changed the file to the sample .caf and it works.. can you not use mp3 for playEventSound?

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.