corona


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.

Related Links

selectively upgrade existing sqlite database in corona by comparing database versions
Corona Near Field Comunication (NFR)
How can i make random generated quotes
Using perspective library with Corona SDK
What is the right way to zoom the camera out from a scene view?
Corona SDK Runtime Error on version 3.0.0
corona loadRemoteImage loading in another scene
What is a simple splash screen code for corona?
How to resize pickerwheel on corona sdk
How to allow external music/audio to continue in Corona SDK apps when they launch?
Can I put apps made on Corona SDK for windows on IOS?
Define coordinates with rotation (corona sdk)
Open 3rd party application in corona sdk
Corona SDK variable throughout different scenes
How to show Pop-ups in Corona SDK?
IDE for Corona SDK for Mac

Categories

HOME
user-interface
memory
clearcase
yahoo-weather-api
long-integer
stacktrace.js
loopbackjs
dafny
celery
docker-cloud
google-play-services
portable-class-library
tibco
phpmqtt
azure-logic-apps
hspi
heuristics
sap-fiori
game-maker
bundler
jodatime
django-rq
maven-plugin
multiple-tables
raml
wsf
spring-shell
activeadmin
tableview
kaggle
altium-designer
jpa-2.1
webviewclient
multi-dimensional-scaling
beego
marquee
materialize
opnet
gsp
wdk
assertions
code-rally
django-crispy-forms
classnotfoundexception
httphandler
zend-form
react-intl
realstudio
webalizer
return-type
cordova-ios
sequence-diagram
aurelia-fetch-client
sesame
lvalue
dynamics-crm-4
oracle-fusion-apps
researchkit
thread-exceptions
openquery
nvda
traversable
oci
unsigned
apple-configurator
simian
processor
jeditable
vimperator
i2b2
phpquery
self
gluon-desktop
uitest
replicaset
android-handler
findersync
baseadapter
hp-idol-ondemand
rubber
network-printers
windows-messages
git-reset
usb-flash-drive
lync-2010
pbkdf2
colon
disjoint-union
node.js-stream
sly-scroller
struts2-json-plugin
qtextbrowser
haiku
data-dump
airprint
cleartype
rtti
regioninfo
rendering-engine

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App