views:

286

answers:

4

Hi,

I'm playing multiple wav files (I tried using caf but same thing happen) with AVAudioPlayer. All the files are less than 2 sec, and 16 bit sound - file size is ~40kb.

I found it makes small noise (it's hard to describe, but a small sound like 'dub') in two cases:
1) when a play is paused or stopped while playing.
2) when a play finishes while another sound is playing (no noise when a sole player finishes its playing)

The noise is not loud, but when I do this play a lot in my app and it really annoys. It happens both in simulator and iphone.

I searched web really hard but couldn't find any similar issues, and I really wonder what the problems are. Any ideas are appreciated. Thanks.

A: 

Just guessing here but have your tried setting volume to 0.0 before pausing or stopping?

John Fricker
I tried your suggestion, but didn't work out. I kind of reduced the problem and will post below.
elios786
A: 

I'm posting to my own question.

I don't really find the answer, but some observations might be useful.

1) It seems loading the sound file through NSData rather than NSURL works faster later in playing.
2) CAF seems a little better than wav, but not much.

I didn't have thorough experiment on this yet. If anyone has clearer idea, let me know. Thanks.

elios786
A: 

if it's doing it in the simulator then I can say with almost absolute certainty that it's only on the simulator. I've had bugs with that too. normally after playing a sound it'll go shoo shooo shoo (that's the best I can describe it). Try it on the device and see if it does it there.

Matt S.
It's almost same in the device too. Probably difference issues here, but thanks anyway.
elios786
A: 

Any better solutions? I've encountered the same issue, and I'm playing several audio events per second, so that sound is obnoxious.

Jon