When it comes to digital signal processing, there's one puzzle that remains even once processing is complete. How do you fit the processed signal back inside the permissible limits of the digital number format? This post describes the "why" and the "how" of two different approaches you can take to get around this obstacle and finish the operation.
Analog audio recordings comprise continuous waveforms which have been applied to some sort of media carrier— for example, metal tapes with varying magnetization, vinyl discs with wave-shaped grooves, or radio waves with varying amplitude. These continuous waveforms are then translated by some device into an electrical signal, which in turn is amplified and passed through to drive the loudspeakers.
Since the introduction of the Compact Disc, recorded waveforms have been approximated by discrete (in the meaning ,"non-continuous") and dense streams of numbers. Which is, in fact, the whole meaning of digital: Digits —> numbers. Many more digital audio representations exist, such as audio tracks on DVD and MiniDisc, as well as audio streams from Spotify, Sound Cloud, and Apple Music, just to mention a few. They are all just basically providing streams of numbers that the corresponding playback equipment translates into enjoyable sound waves.
Historically, in order to fit 74 minutes (the length of Beethoven's Symphony No. 9) worth of stereo sound digitally on a Compact Disc with an acceptable frequency response and dynamic range, it was once agreed and decided that the waveforms (displacement) should be approximated by fixed-point numbers represented by 16 bits. This means the displacement numbers are equally spaced within a limited range instead of the continuous analog waveform. A key component in a digital audio playback system is the Digital-to-Analog Converter (DAC), designed to work only with numbers within this limited range, in order to restore a smooth analog signal that can be amplified and passed on to the loudspeakers [source].
At Dirac, we've invented and developed methods to modify the source signal, here represented by these CD-fitted numbers, to better fit your loudspeakers, your headphones, your car, and your room. Ultimately, this gives you better sound. A more general term for this number modification is digital signal processing. Dirac Live is a special case of digital signal processing.
Processing a signal with the requirement to conserve perceived loudness will inevitably sometimes make the signal fall outside of the range allowed by the 16-bit representation. For example, adding two numbers that both are just within the limits of the 16-bit representation may result in a number that actually requires 17 bits for proper representation. The computation resolution within the processing itself may have a virtually unlimited resolution, so that doesn't impose any practical limitation on the size of the numbers. It is not until the processing has completed that we need to fit the result into a 16-bit representation required by the media carrier format or the DAC (Digital-to-Analog Converter). Figure 1 represents the signal before processing, and Figure 2 represents the signal after it's been processed by a Dirac Live filter (see figures below).
This is where the sound systems of the world can be divided in two categories: Those that can handle digital headroom and those that gain from signal limiting.
Digital headroom means that all the resulting numbers after processing are scaled down by a small fixed factor to enable them to fit back into the 16-bit representation. This case is illustrated in Figure 3, where you can see that the overall level is slightly lower than that of the processed output in Figure 2. As a consequence, the sound may be perceived as slightly softer. This approach is suitable when the playback level is not a big issue. Amplifiers and loudspeakers of reasonable hi-fi quality have sufficient resources to compensate for a slight reduction in signal level; there is enough power to increase the volume to compensate for the digital headroom in the signal.
Figure 1: The original signal fits within the +/- 1 limits set by the 16 bit representation.
Figure 2: After processing, the filter applied has caused certain transients to extend beyond the +/- 1 limits set by the 16 bit representation. If this signal would be passed to the DAC (Digital-to-Analog Converter) it would cause clipping that might be audible.
Figure 3: Applying a fixed attenuation to the processed signal, we get the transients back within bounds. The side effect is a slightly softer signal that needs to be compensated with a slightly increased volume level.
Signal limiting, on the other hand, is a different approach which is suitable in instances when the sound system may instead benefit from an additional push to maintain (or even increase) the perceived sound level. This is the case, for example, with smartphones' internal speakers or small portable wireless speakers. In principle, signal limiting will make it possible to keep the same average signal level after processing, as long as the signal is not too close to the boundaries of the 16-bit digital representation. But if the signal approaches or exceeds the boundaries of the digital representation, an adaptive attenuation (time-varying damping factor) is applied to the signal to gently and temporarily "squeeze" it in within the allowed boundaries. The sound quality improvement from Dirac processing can then be enjoyed without a perceived loss of loudness—and if desired, it can be enjoyed even louder. This case is illustrated by Figure 4. You can see that the overall level is maintained, in comparison to the processed output in Figure 2, but that the largest peaks have been damped to fit within the allowed range.
Figure 4: Applying a signal limiter to the processed signal maintains the overall loudness of the processed signal (Figure 2) by attenuating the signal only when necessary.
However, with both methods there will remain a small probability of signal saturation. Maybe the gain adaptation of the signal limiting is not fast enough (adaptation that is too fast may be slightly audible on a good system) to catch all the numbers that fall outside the allowed range. Or maybe the small fixed digital headroom is not enough to absorb every single occurrence of extended signal range after processing. In these rare situations, a soft clipper or hard limiter will bring the signal into the allowed range. A valid question is: If you know the actual processing Dirac is applying, can't you calculate what a sufficient digital headroom would be? Yes, you can. But this question deserves a blogpost of its own, so look out for the sequel.
If you like experiments I can recommend you test the effect of varying digital headroom for processing using the Dirac Audio Processor (DAP), which is part of the Dirac Live Room Correction Suite (DLRCS). Download it as a free trial here.
The DAP applies digital headroom which you can adjust yourself. It has a small "LED" that indicates when clipping occurs. Depending on the recording or your personal taste, you can adjust the digital headroom (in the DLRCS user manual it's called "DSP Gain") to trade-off between more loudness and less probability of clipping. I encourage you to experiment for yourself with the available adjustments in order to experience the audible effect of clipping. Note however, that if your system volume control is applied upstream of the Dirac processing, saturation is only likely to happen (if at all) at the highest volume levels.
In the meantime, may I ask your opinion in a matter? If the DSP Gain setting in the DAP would have a user-option to apply a signal limiter that engages when necessary, would you use this to set the DSP Gain to 0 dB or even higher?
This blogpost series takes a real life, practicality-meets-science approach to explore some of the challenges with digital audio processing, and provide examples of how Dirac technologies can be applied in your own at-home audio experiments to ultimately make day-to-day listening even more enjoyable.