Changing playback rate of AVPlayer produces choppy Audio
Asked Answered
M

0

6

I am using AVPlayer in my app. My app supports the change of speed of playback of audio and video. I am initializing the player as follows.

 AVPlayerItem * playerItem= [AVPlayerItem playerItemWithURL:self.audioUrl];
     playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmSpectral;
     self.player = [AVPlayer playerWithPlayerItem:playerItem];
        self.player.allowsExternalPlayback= YES;
[self.player.currentItem addObserver:self
                                  forKeyPath:@"status"
                                     options:0
                                     context:nil];

and when i have to change the playback rate of audio i do as follows

self.player.rate = 2.0f;

It was working fine. But recently when i change the rate property of AVPlayer it start producing choppy voice. I already have set the audioTimePitchAlgorithm to

AVAudioTimePitchAlgorithmSpectral

but still it producing choppy voice. Can anyone tell me what i am doing wrong, or what i have to do to avoid this choppy voice and to produce smooth sound.

Mathematics answered 28/7, 2016 at 8:8 Comment(4)
Its not helpful as it is related to AVAudioPlayer while i am asking for AVPlayer. Also setEnableRate is not property of AVPlayerMathematics
Have you tried set audioTimePitchAlgorithm to AVAudioTimePitchAlgorithmLowQualityZeroLatency? might be the latency which causing choppy?Northrup
i Tried this but this produced poor quality soundMathematics
if you tried ZeroLatency which was only caused poor quality but without latency, so it possible because of the latency which causing choppy. so how about using AVAudioTimePitchAlgorithmTimeDomain ? not sure this would solve this issue, but at least can locate the core of this issue?Northrup

© 2022 - 2024 — McMap. All rights reserved.