Pre-emphasis

From Hydrogenaudio Knowledgebase

Jump to: navigation, search

Pre-emphasis is the first part of a noise reduction technique in which a signal's weaker, higher frequencies are boosted before they are transmitted or recorded onto a storage medium. Upon playback, a de-emphasis filter is applied to reverse the process. The result is a higher signal-to-noise ratio (SNR); the original frequencies are restored, but noise that was introduced by the storage medium, transmission equipment, or analog/digital conversions is quieter than it would have been if no filtering had been done. Pre- and de-emphasis can be collectively referred to as just emphasis.

Emphasis was sometimes used in digital storage media in the late 1970s through early 1980s, including on a small percentage of audio CDs. Emphasis is akin to Dolby noise reduction for tapes, or the RIAA equalization curve for vinyl records.

Contents

[edit] Pre-emphasis on audio CD

Some early digital recording & playback equipment, including CD players, used 14-bit converters, even though they were dealing with 16-bit audio. Some also used noisy "brick wall" filters to remove frequencies higher than the Nyquist frequency (22050 Hz). The resulting noise introduced by these converters and filters could be made relatively quiet by using pre-emphasis: boosting the signal (especially the higher frequencies) in the recording before it was put onto CD, and embedding flags in the disc's subcode to tell a CD player to apply de-emphasis on playback. Some CD players even had a de-emphasis button that could be used to manually apply de-emphasis, but now it's just a built-in feature of the analog outputs of nearly all dedicated audio CD players. By the late 1980s, pre-emphasis stopped being used because reliable 16-bit DACs with oversampling and other technologies minimized the conversion & filtering noise without the need for pre-processing the recording.

Most major-label CDs with pre-emphasis were manufactured in Japan in the early and mid-1980s. Relatively recent forum posts indicate that pre-emphasis is still used on newly manufactured CDs by some indie labels, mainly for classical titles.

A pre-emphasis flag for each track is normally stored in the subcode along with the audio data. It's also supposed to be stored in the table of contents (TOC), but many CDs have TOCs that say there's no pre-emphasis when in fact the subcode says there is. There are also some CDs which people believe were mastered with pre-emphasis, but which have no pre-emphasis flags set at all.

[edit] Pre-emphasis on audio CD in computers

CD drives in computers aren't exactly like regular CD players.

Some drives, especially older internal drives on desktop/tower PCs, have analog audio outputs which connect directly to a soundcard via a special cable. In this situation, the drive's own DAC is converting the CD's audio data into analog signals, and the OS or soundcard provide a "CD" volume control specifically for this signal. When audio is being fed to the soundcard this way, or listened to through a headphone connector on the drive itself, then the drive is probably doing its own de-emphasis.

Most OSes and drives nowadays, by default, instead use a digital interface to send the raw audio data straight from the disc, through the drive's regular connectors (IDE/ATAPI, SCSI, USB, whatever) and into the operating system, which passes it along to whatever program needs it. This is the only method used in DAE (digital audio extraction). During playback, the soundcard's DAC is converting the CD's audio data into analog signals, and the volume control for it is usually just the Wave volume control, as is used for most other sounds originating inside the computer. The soundcard usually has no ability to do de-emphasis, and even if it could, it has no access to info about the presence of pre-emphasis, because it's just being fed the waveform data, not the disc's subcode.

In other words, even though a CD drive may be capable of detecting pre-emphasis flags in the disc's subcode and/or TOC, this information is usually completely ignored when sending audio data through the digital interface. So when you play a CD through your computer, or use CD ripping software to get the audio content, you're probably getting the pre-emphasized audio data. Since it has not been de-emphasized, it will probably sound too "bright" and/or hissy (although your audio equipment or your damaged ears may keep you from noticing). Therefore you may want to do de-emphasis processing yourself.

[edit] De-emphasis processing

De-emphasis was designed to be performed in the analog domain by physical electrical components. However, digital audio data can be mathematically manipulated to simulate the effect of analog signal processing, sometimes with a greater degree of accuracy than is possible with physical components, depending on the method used.

There are various methods for applying digital de-emphasis, each with pros & cons. They all basically amount to turning down the upper midrange & treble with a special EQ curve that bottoms out at about -10 dB @ 20+ kHz. This can be done during playback with a simple equalizer setting, or processing extracted audio data before or after it is written to files. The biggest problems with these methods (as with any digital signal processing) are precision, accuracy, and noise. Forum posts indicate EQs in media players tend to be very inaccurate and noisy; a filter designed specifically for de-emphasis is preferable.

Some CD ripping software will detect pre-emphasis flags in the subcode (if the drive supports it) and can apply a digital de-emphasis filter:

  • iTunes (Mac OS & Windows) - recent versions detect pre-emphasis in subcode and apply de-emphasis automatically for both playback and ripping.
  • Windows Media Player (Windows) - recent versions detect pre-emphasis in subcode and apply de-emphasis automatically, but just for playback, not ripping.
  • cdda2wav (multi-platform) - a command-line app (part of the cdrtools package) which can be invoked with a -T parameter to apply de-emphasis as it rips; e.g. cdda2wav -D 0,0,0 -B -T (first use cdda2wav -scanbus to figure out the right device values for the -D option).

Some audio processing software can apply a de-emphasis filter to already-extracted audio (files on disk), producing new files:

  • WaveEmph (Windows) - processes one WAV file at a time, and can optionally apply a volume gain at the same time. Note: after unzipping, right-click on the .exe and set Win98 compatibility before running it for the first time.
  • SoX (multi-platform) - a command-line app which can be invoked with a deemph parameter to apply a de-emphasis filter; e.g. sox input.wav output.wav deemph.

Some audio software can apply a de-emphasis filter during playback or conversion:

  • foobar2000 (Windows) - this media player can be configured to use any of the plug-ins below.
    • foo_dsp_deemph and foo_deemph are two versions of the same filter. They will apply the SoX de-emphasis algorithm only during playback or conversion of specially tagged files. Use the DSP version if you want to process lossy files or you want to control where in the DSP chain the processing occurs. Otherwise, use the post-processing version, which will automatically apply during playback and ReplayGain-scanning of specially tagged, lossless, 44.1 KHz files. It will also apply during conversion of such files, if "Enable decode postprocessing" is checked in the converter setup.
    • foo_dsp_effect is a multi-effect DSP and postprocessor which can be configured to apply de-emphasis during playback and conversion of specially tagged files. It will also apply during conversion of such files if "Enable decode postprocessing" is checked in the converter setup. Only enable one option, though (the DSP or the postprocessing).
    • foo_dsp_convolver is an unofficial "convolver" DSP which can transform audio based on "impulse" files. It's possible to configure it to do de-emphasis by using a special impulse file (or a simpler one) and auto level adjust disabled. (foo_convolve is the official convolver component, but with these impulses isn't ideal because it outputs slightly more samples than were input.)

WaveEmph, SoX, and all of the foobar2000 plug-ins have been tested and produce nearly identical output. The differences are minuscule and inaudible.[1][2]

[edit] Pre-emphasis in cue sheets

Pre-emphasis can be specified in a cue sheet using FLAGS PRE. This will tell the CD burning software to set the pre-emphasis flags in the subcode and TOC of a CD to be burned.

[edit] External links

The following threads & articles contain useful information
  1. http://www.hydrogenaudio.org/forums/index.php?showtopic=99394&view=findpost&p=824194
  2. http://www.hydrogenaudio.org/forums/index.php?showtopic=99394&view=findpost&p=824806
Personal tools