5

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.

Abuzar Amin
  • 1,981
  • 1
  • 19
  • 33
  • Its not helpful as it is related to AVAudioPlayer while i am asking for AVPlayer. Also setEnableRate is not property of AVPlayer – Abuzar Amin Jul 28 '16 at 09:03
  • 1
    Have you tried set `audioTimePitchAlgorithm` to `AVAudioTimePitchAlgorithmLowQualityZeroLatency`? might be the latency which causing choppy? – R. JA Jul 29 '16 at 01:39
  • i Tried this but this produced poor quality sound – Abuzar Amin Aug 01 '16 at 11:16
  • 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? – R. JA Aug 02 '16 at 07:31

0 Answers0