Perceptual Quantization

Vicente González Ruiz & Savíns Puertas Martín

November 19, 2026

Contents

1 A model of the Threshold of (Human) Hearing
2 Bark Scale (BS)
3 Considering the DWT’s dyadic decomposition
4 Considering the WPT linear decomposition)
5 Considering the MDCT high-resolution linear decomposition
6 Not everyone hears the same way
7 Quantization noise
8 Lossy and near-lossless encoding
9 Deliverables
10 Resources

1 A model of the Threshold of (Human) Hearing

Psychoacoustics (see the sound, the human auditory system, and the human sound perception) has determined that the HAS (Human Auditory System) has a sensitivity that depends on the frequency of the sound. Such behaviour is described by the so called ToH (Threshold of (Human) Hearing). This basically means that some subbands (intervals of frequencies) can be quantized with a larger quantization step than others without a noticeable increase (from a perceptual perspective) of the quantization noise [2]. In other words, the threshold of hearing tells us how much noise you can hide in each subband.

Figure 1: A model for the threshold of human hearing.

A good approximation of ToH for a 20-year-old person can be obtained with [1]

\begin{equation} T(f),[\text {dB}] = 3.64(f[\text {kHz}])^{-0.8} - 6.5,e^{-0.6(f[\text {kHz}]-3.3)^2} + 10^{-3}(f[\text {kHz}])^4 . \label {eq:ToHH} \end{equation}

This equation has been plotted in Fig. 1.

2 Bark Scale (BS)

The frequency resolution of the HAS is finite. This basically means that two tonal sounds almost sound the same when they have similar frequencies. Moreover, the minimal distance in frequency to confuse both depends on their frequencies: if the frequency is low, the distance must be smaller. Such behaviour can be described by the Bark scale (see also this), where as it can be seen, the size of the “critical” bands increases with the frequency.

Considering both concepts, the ToH and the BS, we can improve (subjectively) the quality of the sound for a given bit-rate. The idea is to use a different QSS for each critical band. The QSSs should resemble the ToH curve, and the bandwidth of the subbands should follow the tendency of the size of the critical bands.

3 Considering the DWT’s dyadic decomposition

The number of subbands generated by the DWT is

\begin{equation} N_{\text {DWT}} = L_{\text {DWT}}+1, \end{equation}

where \(L_\text {DWT}\) is the number of levels of the DWT [3]. Notice that, except for the \({\mathbf l}^{N_{\text {levels}}}\) subband (the lowest-pass frequency of the decomposition), it holds that

\begin{equation} W({\mathbf w}_s) = \frac {1}{2}W({\mathbf w}_{s-1}), \end{equation}

being \(W(\cdot )\) the bandwidth of the corresponding subband. Therefore, considering that (by default, in InterCom) the bandwidth of the audio signal is \(22050\) Hz, the bandwidth \(W({\mathbf w}_1)=22050/2\) Hz, \(W({\mathbf w}_2)=22050/4\), etc. It is also true that (see InterCom: a Real-Time Digital Audio Full-Duplex Transmitter/Receiver)

\begin{equation} W({\mathbf l}^{L_{\text {DWT}}}) = W({\mathbf w}^{L_{\text {DWT}}}). \end{equation}

Unfortunately, as it can be seen, the DWT does not provide a good decomposition if we want to use a different QSS for each critical band (\(N_{\text {DWT}}\) is generally too small1 and the size of the subbands does not resemble the BS critical bands).

4 Considering the WPT linear decomposition)

The WPT is an extension of the DWT where the 2-channels PRFB is applied also recursively to the high frequencies (see Milestone Transform Coding for Redundancy Removal). Now, the number of subbands generated by the WPT is

\begin{equation} N_{\text {WPT}} = 2^{L_{\text {WPT}}}, \end{equation}

where \(L_\text {WPT}\) is the number of levels of the WPT [3].

Notice that, in this case, \(N_{\text {WPT}}\) can be much larger than \(N_{\text {DWT}}\), and it is hold that

\begin{equation} W({\mathbf w}_s) = W({\mathbf w}_{s-1})\quad \forall s, \end{equation}

i.e., all the WPT subbands have the same bandwidth.

5 Considering the MDCT high-resolution linear decomposition

The MDCT generates a total of \(N\) coefficients for \(2N\) samples, but because it is computed in an overlapping manner, in the end we have \(N\) subbands for each \(N\) input samples. Therefore, each MDCT coefficient represents a subband (for a chunk size of \(N\) samples) with a width of \(f_s/2/N\) Hz. Therefore, MDCT offers a better spectral resolution than DWT and WPT.

6 Not everyone hears the same way

The ToH curve [1] varies between individuals:

  1. In general, women hear better than men.
  2. With age, we lose sensitivity to high frequencies.
  3. Exposure to loud noises over time can elevate the ToH, especially in individuals exposed to loud sound.
  4. Auditory training can help to detect sounds at lower intensities or distinguish subtle nuances in tone.

And this can be said without considering your local audio infrastructure.2

7 Quantization noise

A uniform quantizer with step \(\Delta _k\) in the \(k\)-th subband introduces an error that, for a sufficiently fine quantization, is approximately uniformly distributed in \([-\Delta _k/2, \Delta _k/2]\). Its power is therefore3 (see Milestone Bit-rate Control)

\begin{equation} \sigma _k^2 = \frac {\Delta _k^2}{12}. \end{equation}

The quantization noise is inaudible if, in each subband, its power does not exceed the threshold of hearing for that subband. Let \(P_k\) be that maximum allowed power, obtained from the ToH model evaluated at the center frequency \(f_k\) of the subband and converted from dB to linear scale:

\begin{equation} P_k = 10^{T(f_k)/10}, \end{equation}

where \(T(f_k)\) is the value of the ToH curve evaluated at \(f_k\). Requiring \(\sigma _k^2 \le P_k\) gives

\begin{equation} \Delta _k \le \sqrt {12 P_k}. \label {eq:find_delta} \end{equation}

This expression relates the ToH curve to the quantization step size (QSS) of each subband: where the ear is less sensitive (larger \(P_k\)), a larger QSS can be used, and vice versa.

Notice that the ToH is the threshold in silence. In the presence of a signal, masking raises the audible threshold, so Eq. \eqref{eq:find_delta} is a conservative choice. If the target bit-rate does not allow \(\Delta _k\) to satisfy this condition (the inaudibility, Eq. \eqref{eq:find_delta}) in every subband, a reasonable strategy is to keep the same noise-to-threshold ratio4 (noise power divided by the allowed (threshold) power in the subband):

\begin{equation} \text {NTR}_k = \frac {\sigma ^2}{P_k} = \frac {\Delta _k^2}{12P_k}, \end{equation}

in all subbands, that is, to scale all the \(\Delta _k\) by a common factor, rather than spreading the noise equally (using the same QSS in all subbands).

8 Lossy and near-lossless encoding

Eq. \eqref{eq:find_delta} always will quantize (using a value larger than 1) the very low and high frequency subbands, even if the bit-rate control algorithm determines that the “master” QSS can be 1, i.e., we don’t need to quantize. For this reason, it is proposed—for each subband—to calculate the quantization step size as the maximum value between 1 (no quantization) and the value \(\Delta _k\) derived from Eq. \eqref{eq:find_delta}. However, the entire curve is first shifted downward such that when the "master" \(\Delta \) (determined by the bit-rate control algorithm) is 1, \(\Delta _k\) also equals 1 for all subbands. Consequently, as \(\Delta \) increases (if the bit-rate control algorithm so dictates), only those subbands most susceptible to quantization will begin to be quantized, while those less susceptible will remain at \(\Delta _k = 1\).

9 Deliverables

The module ToH_WPT_coding.py implements the idea of perceptual quantization after using WPT. Write a new module called ToH_MDCT_coding.py that performs the same task, but on an audio sequence processed with the MDCT. Make sure to allow that if \(\Delta =1\), then \(\Delta _k=1~\forall k\). Use a notebook to generate (write to disk) the module ToH_MDCT_coding.py, evaluate, and describe the implemented algorithm.

10 Resources

[1]
M. Bosi and R.E. Goldberd. Introduction to Digital Audio Coding and Standards. Kluwer Academic Publishers, 2003.
[2]
K. Sayood. Introduction to Data Compression (Slides). Morgan Kaufmann, 2017.
[3]
M. Vetterli and J. Kovačević. Wavelets and Subband Coding. Prentice-hall, 1995.