Hello,
I have problems with sound,it’s is late about on 0.5-07 seconds. In Corona simulator I haven’t this problem, but I have it on all devices. I use 44kHz and 320 bitrare sound, maybe problem in it?
Hello,
I have problems with sound,it’s is late about on 0.5-07 seconds. In Corona simulator I haven’t this problem, but I have it on all devices. I use 44kHz and 320 bitrare sound, maybe problem in it?
What version of Corona SDK are you running and what devices is it lagging on?
Rob
Corona SDK version 2013.2100 and I have lagging on Samsung galaxy s3, nexus 7 and LG p970
This is a known version on older versions of Android. I work around it by calling media.playSoundEvent() on Android, audio.play() on iOS. Rob can give you all the gory details of why this happens.
Well the gory details is this is a Google bug using the OpenAL library. Google fixed it in 4.1, so any older versions of Android are going to lag using the audio.* library. While we want you to use that library since you have volume control on 32 simultaneous mixed sounds with more flexibility, the only solution for time dependent, short sounds, you should use the media.playEventSound() API understanding its limits of not being able to mix sounds with it.
Thanks for reply.
I tried it, but problem not be resolved. don’t know, maybe I doing something wrong, but with it I have a more lagging and freezing.
And you say this problem for android 4.1 and earlier. In galaxy s3 i have 4.3 and on nexus 7 i have 4.4.2, but sound lagging
Can you post some code?
Also what kind of sound files are you using? What is their bit rate, Stereo vs. Mono?
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() system.setIdleTimer( false ) display.setStatusBar( display.HiddenStatusBar ) local introVideo = display.newGroup() local titanas local logBG local logoFG local fader local timer1 local timer2 local timer3 local timer4 local tr1 local tr2 local tr3 local tr4 local backgroundMusicChannel local function showTitana() tr1=transition.to(titanas, {time=1000, alpha=1}) end local function showLogo() tr2=transition.to(logoFG, {time=1000, alpha=1}) end local function faderOut() tr3=transition.to(fader, {time=830, alpha=1}) end local function clearAll() audio.stop( backgroundMusicChannel ) introVideo:removeSelf() introVideo=nil timer.cancel(timer1) timer.cancel(timer2) timer.cancel(timer3) timer.cancel(timer4) transition.cancel(tr1) transition.cancel(tr2) transition.cancel(tr3) transition.cancel(tr4) collectgarbage() storyboard.gotoScene("menu") end local nam ="titanas" local function loadAll() logoBG=display.newImageRect(introVideo,"images/logo/logoBG.png",display.contentWidth, display.contentHeight) logoBG.alpha=0 logoBG.x=display.contentWidth/2 logoBG.y=display.contentHeight/2 titanas=display.newImageRect(introVideo,"images/logo/".. nam..".png",102,141) titanas.alpha=0 titanas.x=display.contentWidth/2 titanas.y=107 logoFG=display.newImageRect(introVideo, "images/logo/logo.png",217,62) logoFG.alpha=0 logoFG.x=display.contentWidth/2 logoFG.y=225 fader=display.newImageRect(introVideo, "images/logo/fade.png", display.contentWidth, display.contentHeight) fader.alpha=0 fader.x=display.contentWidth/2 fader.y=display.contentHeight/2 backgroundMusicChannel=audio.play(logo, {channel =1, loops=0}) tr4=transition.to(logoBG, {time=1000, alpha=1}) timer1 = timer.performWithDelay( 1200, showTitana ) timer2 = timer.performWithDelay( 2200, showLogo ) timer3 = timer.performWithDelay( 5170, faderOut ) timer4= timer.performWithDelay(7100, clearAll) end loadAll() return scene
bit rate 128, it’s stereo and .mp3
I don’t see where you are loading any audio and only where you’re playing what appears to be a music track. I’m not sure how this can be out of sync.
When you say bit rate, are you talking a 128khz sound? Because different devices codec’s vary you should use standard bitrates, like 11.025Khz, 22khz or 44khz and mono allows the sounds to be loaded more quickly. Since I cant see where you are trying to do anything other than a background track, it’s hard to tell if it’s a delay in loading the sounds or what.
Rob
I loading sound in main.lua and use for it “audio.loadStream”.
When I say bit rate I meant 128kbps also this sound have 44khz frequency
What version of Corona SDK are you running and what devices is it lagging on?
Rob
Corona SDK version 2013.2100 and I have lagging on Samsung galaxy s3, nexus 7 and LG p970
This is a known version on older versions of Android. I work around it by calling media.playSoundEvent() on Android, audio.play() on iOS. Rob can give you all the gory details of why this happens.
Well the gory details is this is a Google bug using the OpenAL library. Google fixed it in 4.1, so any older versions of Android are going to lag using the audio.* library. While we want you to use that library since you have volume control on 32 simultaneous mixed sounds with more flexibility, the only solution for time dependent, short sounds, you should use the media.playEventSound() API understanding its limits of not being able to mix sounds with it.
Thanks for reply.
I tried it, but problem not be resolved. don’t know, maybe I doing something wrong, but with it I have a more lagging and freezing.
And you say this problem for android 4.1 and earlier. In galaxy s3 i have 4.3 and on nexus 7 i have 4.4.2, but sound lagging
Can you post some code?
Also what kind of sound files are you using? What is their bit rate, Stereo vs. Mono?
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() system.setIdleTimer( false ) display.setStatusBar( display.HiddenStatusBar ) local introVideo = display.newGroup() local titanas local logBG local logoFG local fader local timer1 local timer2 local timer3 local timer4 local tr1 local tr2 local tr3 local tr4 local backgroundMusicChannel local function showTitana() tr1=transition.to(titanas, {time=1000, alpha=1}) end local function showLogo() tr2=transition.to(logoFG, {time=1000, alpha=1}) end local function faderOut() tr3=transition.to(fader, {time=830, alpha=1}) end local function clearAll() audio.stop( backgroundMusicChannel ) introVideo:removeSelf() introVideo=nil timer.cancel(timer1) timer.cancel(timer2) timer.cancel(timer3) timer.cancel(timer4) transition.cancel(tr1) transition.cancel(tr2) transition.cancel(tr3) transition.cancel(tr4) collectgarbage() storyboard.gotoScene("menu") end local nam ="titanas" local function loadAll() logoBG=display.newImageRect(introVideo,"images/logo/logoBG.png",display.contentWidth, display.contentHeight) logoBG.alpha=0 logoBG.x=display.contentWidth/2 logoBG.y=display.contentHeight/2 titanas=display.newImageRect(introVideo,"images/logo/".. nam..".png",102,141) titanas.alpha=0 titanas.x=display.contentWidth/2 titanas.y=107 logoFG=display.newImageRect(introVideo, "images/logo/logo.png",217,62) logoFG.alpha=0 logoFG.x=display.contentWidth/2 logoFG.y=225 fader=display.newImageRect(introVideo, "images/logo/fade.png", display.contentWidth, display.contentHeight) fader.alpha=0 fader.x=display.contentWidth/2 fader.y=display.contentHeight/2 backgroundMusicChannel=audio.play(logo, {channel =1, loops=0}) tr4=transition.to(logoBG, {time=1000, alpha=1}) timer1 = timer.performWithDelay( 1200, showTitana ) timer2 = timer.performWithDelay( 2200, showLogo ) timer3 = timer.performWithDelay( 5170, faderOut ) timer4= timer.performWithDelay(7100, clearAll) end loadAll() return scene
bit rate 128, it’s stereo and .mp3
I don’t see where you are loading any audio and only where you’re playing what appears to be a music track. I’m not sure how this can be out of sync.
When you say bit rate, are you talking a 128khz sound? Because different devices codec’s vary you should use standard bitrates, like 11.025Khz, 22khz or 44khz and mono allows the sounds to be loaded more quickly. Since I cant see where you are trying to do anything other than a background track, it’s hard to tell if it’s a delay in loading the sounds or what.
Rob
I loading sound in main.lua and use for it “audio.loadStream”.
When I say bit rate I meant 128kbps also this sound have 44khz frequency
Is there anymore info on this topic? I have the same issue on HTC One with 4.3 and have around just under .5 second lag. As this is a huge gap there must be something im doing wrong. Would bit rate and mono/stereo make this bug a difference on a device.
Im sing the classic “audio.loundSound” etc