I’m allmost done porting my existing game to WP with CoronaCards but still sounds are missing completely. Tried both .wav and -ogg files but total silence… Code works both in Android and iPhone.
Are you using Corona’s audio.* Lua library?
Because Corona’s media.* Lua library is not currently supported on WP8.
Also, make sure that your *.ogg files’ “Build Action” property is set to “Content” in Visual Studio. This tells Visual Studio to include this file within your app bundle. Instructions on how to do this can be found in steps 5 and 6 here…
http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files
Note that file extensions that Visual Studio does not recognize will not be automatically set to “Content”. So, files such as *.ogg, *.json, *.ttf, etc. will not be automatically included within your app. We warn about this in the link about (Notes box, bullet 3).
I’m using media.* Lua library, so it seems I need to change it to something else? …
Edit…
Got it working using Audio.* library…
Thanks again Josh
Happy to help!
And just to let you know, many Android devices have a latency/lag problem with playing sound files via the audio.* API. That is, there will be a short delay between when you call audio.play() to when the sound actually starts playing. Like sometimes it might be 100-200 milliseconds. This is a problem with the Android OS’ internal audio handling with OpenSL (Open Sound Library) on many devices. But that said, our media.playEventSound() has the least latency on Android because it is tied to Android’s best performing native audio API, but is limited to only playing short sounds (like about 1-2 seconds long). If your app is a game, then you might want to continue using media.playEventSound() for sound effect, but *only* for Android. Something like this…
local mySound if (system.getInfo("platformName") == "Android") then mySound = media.newEventSound("mySound.wav") media.playEventSound(mySound) else mySound = audio.loadSound("mySound.wav") audio.playSound(mySound) end
I know this is kind of inconvenient, but it’s not much better for native Android developers either. I remember that Google claimed to have fixed the Audio latency issue in 4.4’s release notes, but they later removed it from their release notes. The audio latency issue is definitely improved on Google sanctioned Android devices (the ones with the “Nexus” name), but I’m guessing that there are still some 3rd party 4.4 devices that have this latency issue as well. Interestingly enough, I’ve noticed that Google stated in Android 5.0’s release notes that it has “More powerful audio”, but I’m thinking that’s mostly referring to microphone input latency.
I hope the above helps.
Are you using Corona’s audio.* Lua library?
Because Corona’s media.* Lua library is not currently supported on WP8.
Also, make sure that your *.ogg files’ “Build Action” property is set to “Content” in Visual Studio. This tells Visual Studio to include this file within your app bundle. Instructions on how to do this can be found in steps 5 and 6 here…
http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files
Note that file extensions that Visual Studio does not recognize will not be automatically set to “Content”. So, files such as *.ogg, *.json, *.ttf, etc. will not be automatically included within your app. We warn about this in the link about (Notes box, bullet 3).
I’m using media.* Lua library, so it seems I need to change it to something else? …
Edit…
Got it working using Audio.* library…
Thanks again Josh
Happy to help!
And just to let you know, many Android devices have a latency/lag problem with playing sound files via the audio.* API. That is, there will be a short delay between when you call audio.play() to when the sound actually starts playing. Like sometimes it might be 100-200 milliseconds. This is a problem with the Android OS’ internal audio handling with OpenSL (Open Sound Library) on many devices. But that said, our media.playEventSound() has the least latency on Android because it is tied to Android’s best performing native audio API, but is limited to only playing short sounds (like about 1-2 seconds long). If your app is a game, then you might want to continue using media.playEventSound() for sound effect, but *only* for Android. Something like this…
local mySound if (system.getInfo("platformName") == "Android") then mySound = media.newEventSound("mySound.wav") media.playEventSound(mySound) else mySound = audio.loadSound("mySound.wav") audio.playSound(mySound) end
I know this is kind of inconvenient, but it’s not much better for native Android developers either. I remember that Google claimed to have fixed the Audio latency issue in 4.4’s release notes, but they later removed it from their release notes. The audio latency issue is definitely improved on Google sanctioned Android devices (the ones with the “Nexus” name), but I’m guessing that there are still some 3rd party 4.4 devices that have this latency issue as well. Interestingly enough, I’ve noticed that Google stated in Android 5.0’s release notes that it has “More powerful audio”, but I’m thinking that’s mostly referring to microphone input latency.
I hope the above helps.