A little hint for ALSA hda users

Just because this might come useful to someone, and I gave this hint already three times today, if you own an hda-based soundcard and you head crackling sound while playing mp3s or similar, the problem is probably due to the bad samplerate conversion from 44100 to 48000.

A simple way to fix this without recurring to the use of an external audio server like PulseAudio, is to use the samplerate conversion plugin that is present in the media-plugins/alsa-plugins package (with the libsamplerate useflag enabled, as it uses libsamplerate — Secret Rabbit Code), and put something like this in your asound.conf:

defaults.pcm.rate_converter "samplerate"

this way the rate conversion will happen using the fastest libsamplerate converter, that should also give a better quality; as an alternative you can use “samplerate_medium”, “samplerate_best”, “samplerate_order” or “samplerate_linear” to choose a different rate converter from libsamplerate.

This should probably fix the audio artifacts you hear (although I admit I haven’t tried it first hand, as I don’t have any hda-based soundcard beside the laptop).