Sound delay on emulator in corona sdk
I'm currently creating a game with corona sdk. While creating game i faced issues in playing audio files. Issue was that, a tennis ball is dropped on ground and audio should be played. But what happen was the audio was delayed a second. On emulator the audio was synchronized but while i ported apk on my galaxy s2, android version 4.2.2 i faced a delay. Below is the code which i used to play audio. I loaded audio file first as program executed: local audio = audio.loadSound("hit ball.mp3") Then somewhere in middle I used collision and on collision I played that audio file: local function onCollisionSound() audio.play(audio) end ball:addEventListener("collision", onCollisionSound) I also tried with media api but it also didnt worked.
This may be an issue with OpenAL. All audio.* methods are based on OpenAL which is not natively supported by the Android NDK (which supports OpenSL ES instead). The solution to make it work is still a bit buggy and may introduced a delay with some Android versions/devices : (Directly from the Corona SDK documentation of audio.play()) NOTE: A known issue with Android causes sound to be delayed by 1 to 2 seconds when started. You may try to use the deprecated media.* API instead which doesn't use OpenAL, this may resolve your problem.
Generally with Android 4.1 and later, the audio.* API calls shouldn't be lagging. Google fixed the bug in the 4.1 release, but on older versions, it could still be a problem. However, that doesn't mean the device maker hasn't done some things that hurt sound performance. When exact timing is required, we do recommend using media.* API calls. Also, please make sure your sound clip doesn't have any delays at the beginning.
Display json data page wise in corona
After Inapp purshase touch action disabled in corona sdk?
How to parse JSON Data in Corona SDK [duplicate]
How to make an object change its look on collision with another object in corona sdk
Drop Down animation for Image on Tap
Sound is not working properly in Corona SDK
How can i properly align Arabic text using the Corona SDK?
Can we change physics body properties in runtime - corona sdk
How to slide pages in Corona SDK
Return Data on showwebpopup
How to pause game and display new layer in corona
Corona SDK pathToFile issue
How to integrate fortumo In-App purchase plugin to Corona Sdk game?
How to make the PNG's transparent region not be listened by the EventListener when a touch event happened?
Corona SDK - group with image rect, wrong reference point
CORONA SDK Physics that dont affect every sprite