Saturday, December 27, 2008

Getting more quality from onboard sound

Onboard high-definition audio chips are very common now. From the viewpoint of software, they support unbelievable quality of sound reproduction: 24 bits of precision at the 192 kHz sampling rate. The reality is in fact worse, as there is always noise in the analog output that the headphones are connected to.

I am not talking about the thermal noise or 1/f noise that is created intrinsically by every electronic device and sounds like a soft "shshsh...". These kinds of noise are important in radio receivers or tape recorders that have a high-gain amplifier needed to recover a weak incoming signal, but not in computers.

I am talking about the interference, where the signal in one wire (not intended to be played as sound) propagates into the other wire located nearby or to another circuit connected to the same badly-filtered power supply. The exact sound of such interference depends on what the computer is doing. If the computer is doing something periodically (e.g., drawing a scene on the screen 60 times a second, or filling a sound buffer in JACK 500 times a second), this unwanted sound becomes a tone, and thus becomes easily noticeable. Here are the steps that helped me to reduce it in my desktop computer based on the Intel DG965SS motherboard.

First, the wire that picks up a lot of interference is the wire that connects the front headphone socket to the motherboard. It is better to avoid using the front socket at all, and plug the headphones (if the cord is long enough) into the green socket on the back of the motherboard. This way, the cord is screened from the noisy components inside the computer by the metallic case.

Second, it may be a good idea to reduce the time variations of the power consumption of various components in the computer.

E.g., the processor draws a lot of power when it is busy, but consumes less power when it is idle. When it switches between the busy and idle states periodically, it creates a tone in the power line, and that tone ultimately gets to the sound chip output. So, to suppress the tone, one solution would be to keep the processor always busy. This is what the "idle=poll" Linux kernel parameter does. Note that a busy processor runs hot (in my computer, at 47.0°C), so think twice before using this option. A less dragonian solution would be to pass the "max_cstate=3" parameter to the "processor" module. (A big "thanks" goes to Robert Hancock and Sitsofe Wheeler who suggested these parameters.)

The other component of the computer that periodically draws a lot of power is the video card. But it is easier to keep it mostly idle, not busy. The most common desktop process that keeps the GPU busy is a compositing window manager (kwin or compiz). So, disable desktop effects, and enjoy better sound quality.


GByte said...

Hi! :)

Very interest post!
And very interest suggestion! :)

But, i think that using of external sound card can givemore quolity sound.

Alfred said...

Interesting and useful tips.

There is now a new cell-phone microphone noise-reduction method being offered by LG known as DSE Noise Reduction, which is used to reduce the ambient-environment air-conducted background sound noise. In this method, which is an improvement of an older AT&T "differential microphone" patent, the LG phone has two mikes and uses some DSP to look at the time derrivatives of the sound from the two mikes to attenuate sound which has traveled farther to get to the mikes.
With respect to the method of this post, would it be possible to install a second wire (having the same impedance) to the front (and rear) headset jack, which second wire has the same extraneous pickup as the audio wire, however the second wire has no audio.
Now the signals present on the main audio and second wire might possibly be processed differentially to remove the extraneous signals ?

Alexander Patrakov said...

This would probably help eliminate the pickup over the audio wire, but the op amp that would subtract the signals has to get power from somewhere. While generally, op amps reject fluctuations of the supply voltage well, this may or may not be enough for this case. I didn't test.