Audio Volume Fluctuations

I have a screen where I play various sounds. If I leave this screen, go to another and then return, the sounds I play (they are played when two objects collide) can vary in volume. Note, these collisions can occur several at once. Therefore, I use about 10 different channels and loop through them playing each collision on a different channel. This allows the audio to play all the way through. Otherwise, some collisions will not play the sound as the channel is still consumed playing the previous collision.

Any thoughts as to why the volume is changing? I do not mess the volume in this screen. [import]uid: 69863 topic_id: 14943 reply_id: 314943[/import]

I am facing the same issue. My case is even simpler. I just have an audio file playing in the background. Every time I change pages and return to the one with the audio playing, volume gets lower, lower and sometimes the iPad even crashes.

I believe it is related to memory. Here’s my code:

[code]
– Code created by Kwik - Copyright: kwiksher.com
module(…, package.seeall)

function new()
local numPages = 5
local menuGroup = display.newGroup()

local sound_02_aud078 = audio.loadStream( “sound_02.wav” )

local curPage = 3

local disposeAudios

local disposeTweens

local drawScreen = function()
local Layer1
Layer1 = display.newImageRect( “p3_Layer1.png”, 1024, 768 );
Layer1.x = 512; Layer1.y = 384; Layer1.alpha = 1
menuGroup:insert(Layer1)
menuGroup.Layer1 = Layer1
local function flip (event)
if event.phase ==“ended” then
if event.xStart < event.x and (event.x - event.xStart) >= 30 then
if (curPage > 1) then
disposeAudios()
disposeTweens()
director:changeScene( “page_”…curPage-1, “moveFromLeft” )
end
elseif event.xStart > event.x and (event.xStart-event.x) >= 30 then
if (curPage < numPages) then
disposeAudios()
disposeTweens()
director:changeScene(“page_”…curPage+1, “moveFromRight”)
end
end
end
end
Layer1:addEventListener(“touch”, flip)
end
drawScreen()

disposeAudios = function (event)
audio.stop(); audio.dispose(sound_02_aud078); sound_02_aud078 =nil
end

disposeTweens = function (event)
cancelAllTweens();
cancelAllTimers();
cancelAllTransitions();
end

local myClosure_sound_02_aud078 = function()
audio.play(sound_02_aud078, { loops=0, fadein=500 } )
end
timerStash.newTimer = timer.performWithDelay(0, myClosure_sound_02_aud078, 1)

return menuGroup
end
[/code] [import]uid: 4883 topic_id: 14943 reply_id: 61457[/import]