Stutter when playing audio clips using AV
Stutter when playing audio clips using AV
- Subject: Stutter when playing audio clips using AV
- From: Will Archer <email@hidden>
- Date: Tue, 6 Jul 2010 14:01:46 -0600
Hi guys, I'm running into a strange glitch in AVAudioPlayer and I'm wondering what I'm doing wrong. I'm running an app which uses offline rendering to play background music (with a little processing) and play instructional audio clips on top using AVAudioPlayer. This all works as I'd like it to. The trouble I'm running into is AVAudioPlayer occasionally introducing a stutter in the instructional clips. For example, if the original clip was "Ok, go for five minutes", it plays back as "Ok, go for five minutesminutes". I have also heard instances where a minor portion of the audio is omitted. The audio is not distorted or phased in such a way as to suggest that the clip is being played twice in rapid succession, and AVAudioPlayer doesn't return any errors when initiate playback.
My code for playing audio clips follows: (edited for brevity)
- (BOOL)playURL:(NSURL *)url{
NSError *error;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
if (error) {
NSLog(@"Couldn't init url: %@", [url absoluteString]);
return NO;
}
player.delegate = self;
if (![player prepareToPlay]) {
NSLog(@"Error could not prepare %@ for playing", [url description]);
return NO;
}
player.volume = 1.0;
@synchronized(self) {
if (queueStatus == PLAYING) {
AudioSessionSetActive(YES);
[player play];
}
}
return YES;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden