The Flutter app plays various short (~6 seconds) audio files using just audio package. The files sound fine when played on the development system. On most Android devices they sound just fine as well, but on a few devices audio noticeable crackles.
Question is, what can cause an audio files to crackle, and how can it be fixed?
What's interesting is that all the crackling audio files sound very deep, and when replaced with (same length) files that sound high, the problem disappears, making it look (or sound) as this is a problem with the content of the audio files.
Have you ever experienced a similar issue? If so, how have you fixed it?
I doubt that this is an issue with just audio, or how the files are played, but just for the sake of completeness, here's the code:
late AudioPlayer _audioPause;
void loadAudio() async {
// AudioLoadConfiguration has been added during debugging, but doesn't seem to have any effect on the issue.
AudioLoadConfiguration loadCfg = AudioLoadConfiguration(
androidLoadControl: AndroidLoadControl(
prioritizeTimeOverSizeThresholds: true,
minBufferDuration: const Duration(seconds: 10),
maxBufferDuration: const Duration(seconds: 20),
bufferForPlaybackDuration: const Duration(seconds: 20),
),
);
_audioPause = AudioPlayer(audioLoadConfiguration: loadCfg);
await _audioPause.setAsset('assets/audio/pause.wav');
await _audioPause.load();
}
void playPause() async {
await _audioPause.seek(Duration.zero);
await _audioPause.play();
}
Any ideas on how to remove crackling from audio playback are welcome, Thank you.