Audio volume drops suddenly when playing sounds in "quick" succesion

Hi,

I am using

[lua]

            aFreeChannel=audio.findFreeChannel()

            audio.play(whoosh,{channel=aFreeChannel,onComplete=Finish})

[/lua]

for an audio file to play. But when I tap the button quickly repeatedly, the audio suddenly drops in volume.

The audio is loaded with audio.loadSound.

It doesn’t matter if I only load the audio once and then play it with audio.play or if I dispose it after each finish and recreate it for each play session.

Is this happening in the simulator or on device?  What  version of Corona SDK are you using and what operating system? If on device, what device?

Thanks

Rob

2013.2100(2013.12.7)

It also happens on devices, android nexus 7, iphone 5, 5s.

It feels like it has to do with the audio system trying to play a sound on a channel that is already occupied. ( the findFreeChannel might not be fast enough in the update?)

I am using findFreeChannel to not have that happen.

Before I used that it happened a lot more.

I checked if it was a fadeout problem, but the volume gets reset to 1 in the main menu. And it almost never happens.

I have one background music file loaded with loadStream on a loop. 

There are at most 20 other audio files present in the screen. They don’t play until you tap a button. So to have them play at the same time you would have to be almost superhuman. The audio files length is 0.3 seconds. There is no multiTouch enabled.

Are you checking the value returned by findfreechannel to make sure it’s valid?

No, I assumed that is what the findfreechannel was for.

But as I am using less than 32 sounds it should always be a valid number.

I don’t use reserved channels at the moment. So if I have to check everything manually I might as well just make a custom function that just ads 1 every play and if ==32 or 31 then back to 1.

Thing is it doesn’t crash. It just lowers the volume. 

I do use an audio fade to exit my scenes, but in the scene I enter after the audio fade I use a setVolume() with channel set to 0 to reset the volume to 1 for all channels. I use it in the enter scene part of storyboard so I know it will run.

 [lua]

audio.setVolume( 1, { channel=1 } )

[/lua]

Your code confuses me.  It’s only setting the volume on channel 1. 

Can you put together a sample project that cause this and put the zip file somewhere that I can grab it?

Thanks

Rob

Will see if I can do that. Sorry, wasn’t a copy from my code. my code has a 0 for the channel. Don’t have my code here, so I had to go to the docs to see if I didn’t make a typo. Forgot to edit the 0 out.

It is hard to reproduce. Might make an artificial one.

Is this happening in the simulator or on device?  What  version of Corona SDK are you using and what operating system? If on device, what device?

Thanks

Rob

2013.2100(2013.12.7)

It also happens on devices, android nexus 7, iphone 5, 5s.

It feels like it has to do with the audio system trying to play a sound on a channel that is already occupied. ( the findFreeChannel might not be fast enough in the update?)

I am using findFreeChannel to not have that happen.

Before I used that it happened a lot more.

I checked if it was a fadeout problem, but the volume gets reset to 1 in the main menu. And it almost never happens.

I have one background music file loaded with loadStream on a loop. 

There are at most 20 other audio files present in the screen. They don’t play until you tap a button. So to have them play at the same time you would have to be almost superhuman. The audio files length is 0.3 seconds. There is no multiTouch enabled.

Are you checking the value returned by findfreechannel to make sure it’s valid?

No, I assumed that is what the findfreechannel was for.

But as I am using less than 32 sounds it should always be a valid number.

I don’t use reserved channels at the moment. So if I have to check everything manually I might as well just make a custom function that just ads 1 every play and if ==32 or 31 then back to 1.

Thing is it doesn’t crash. It just lowers the volume. 

I do use an audio fade to exit my scenes, but in the scene I enter after the audio fade I use a setVolume() with channel set to 0 to reset the volume to 1 for all channels. I use it in the enter scene part of storyboard so I know it will run.

 [lua]

audio.setVolume( 1, { channel=1 } )

[/lua]

Your code confuses me.  It’s only setting the volume on channel 1. 

Can you put together a sample project that cause this and put the zip file somewhere that I can grab it?

Thanks

Rob

Will see if I can do that. Sorry, wasn’t a copy from my code. my code has a 0 for the channel. Don’t have my code here, so I had to go to the docs to see if I didn’t make a typo. Forgot to edit the 0 out.

It is hard to reproduce. Might make an artificial one.