Domanda

I'm using AudioTrack in streaming mode. About one out of 5-10 times after I stop playback of a short section of a wav file, I hear a clicking noise. It's driving me crazy because I can't consistently reproduce it. I've tried various combinations of calls to AudioTrack.flush(), AudioTrack.pause(), and AudioTrack.stop() before calling AudioTrack.release(). I've also tried calling AudioTrack.setStereoVolume() and passing in the result of AudioTrack.getMinVolume(). Nothing has worked.

Some observations:

  • It seems to happen only when I play a short section of a wav file. I can't reproduce it when I play more than 3 seconds of audio.
  • Occasionally, AudioTrack.write() returns -22 when I'm writing the end of the audio data. I don't see a spec for -22 in the Javadoc. Also, this case does not always coincide with the click.
  • The click is not consistently reproducible even if I replay the same section of the wav file.
  • The clicking sound can come out of the right or left speaker, but not both.

I'm seeing this on an Acer Iconia A500 running Android 4.0.3. I would appreciate any suggestions.

È stato utile?

Soluzione

The pop is probably because the song ended on a very high sample, and then became suddenly 0. This causes a 'pop' noise. Try fading the song out over the course of even 0.01 of a second.

The pop from going from high sample to 0 volume sounds like this: https://soundcloud.com/hertzdevil/dirac

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top