1
votes

I use AVPlayer to play streamed network audio.

I modify the sample code AVPlayerDemo from Apple

The work is good. But after play for a while, the player has noise sound, someone call "scratch sound".

I checked the code, anytime my player has only one AVPlayer object, one AVPlayerItem objet for marking, one AVURLAsset object for marking. I use "alloc, retain, realease" explicitly, so it's not problem of memory overhead.

Can you know any reason cause the noise sound? Thank you

1

1 Answers

2
votes

I am having a similar problem. Using an AVPlayer or AVAudioPlayer for a length of time, in my case to play multiple clips with pauses in between, causes the audio to degrade. First it begins to get scratchy, then as it gets worse it eventually drops off completely and is inaudible.

I have attempted creating new AVAudioPlayer's for each clip to no avail.

I am suspect that the audio files themselves (*.m4a) are causing the problem. Some contain static themselves even after a few rounds of noise reduction. Though the static within them is not the static the AVAudioPlayer is introducing.

I am working on two alternate theories and a theory;

  1. Use the original *.wav files or *.mp3 files
  2. Deactivate/Activate the AVAudioSession between clips or periodically.
  3. This may be just a simulator problem and not happen on the device (theory).

Though these may not be applicable to your stream, perhaps there is a solution in here somewhere.

UPDATE: *.wav vs *.m4a makes no difference.

UPDATE: This is not happening on the device itself, only in the simulator for me.