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

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

Categories

HOME
google-chrome
python-2.7
spring-data
entity-framework
android-studio
apache-nifi
matrix
clearcase
facebook-messenger
adfs3.0
bokeh
paypal-ipn
key
kivy
plpgsql
yql
dronekit-python
gallery
google-search-console
minecraft
specifications
selection
driver
vertica
asciimath
psql
jitsi
social-tables
unity-container
web-analytics
msdeploy
adapter
sales
social-networking
delayed-job
seafile-server
knights-tour
custom-keyboard
char-pointer
testlink
nsuserdefaults
love2d
ms-dos
android-n
stat
icepdf
viewcontroller
optionaldataexception
xcode8.2
bit-shift
flume-twitter
photoswipe
nonlinear-functions
popen
email-forwarding
msxml
allegro
controllers
callouts
cdo.message
meld
onepage-checkout
webgrind
deeplink
nastran
unhandled
wlanapi
uitest
darwin
textscan
ocmockito
zend-mail
xml-signature
lmax
ecos
nidaqmx
lumia-imaging-sdk
nachos
preorder
mod-perl
illuminate-container
san
iirf
hints
jacob
insertion
oscilloscope
ofstream
pageheap
platform-independent
type-safety
servercontrol
office-automation
asp.net-mvc-views
printqueue
dip
fuzzy-comparison
motif
comment-conventions
regioninfo

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App