0
votes

I am using AVAudioPlayer, When i pressed button, the sound is playing but its lazy(or giving me late feedback), How can i play sound with rapid feedback..Thanks

2

2 Answers

1
votes

Are you calling prepareToPlay before trying to play the sound? As the method suggests this does all the preparation, meaning subsequent calls to play should be very quick.

If you need even lower latency, you may need to use AVAudioQueues though.

1
votes

Try Like this...

In .h

AVAudioPlayer *playerBG

In .m

AVAudioPlayer *pp = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Ting" ofType:@"wav"]] error:nil];
self.playerBG = pp;
[pp prepareToPlay];
[pp release];