## 3 Theoretical Background
### Discrete Cosine Transform (DCT) and Inverse DCT (IDCT)  
The DCT transforms a signal into the frequency domain, similar to the discrete Fourier transform (DFT). However, unlike to the DFT, the DCT relies only on real-valued cosine functions; therefore, it is simpler to compute [50]. Another property that makes the DCT superior to the DFT is its high spectral compaction. Therefore, a signal's DCT transformation includes more energy in fewer coefficients than other transformations, such as the DFT.  
For sparse encoding of a signal, where a small number of nonzero samples are required, this is preferable. Due to the small number of DCT coefficients that hold substantial energy in a speech signal, all remaining coefficients can be reduced to zero without losing any significant information [51]. Therefore, the voice signal will be sparsely represented in this way.  
Figure 3 illustrates the process of generating a sparse signal representation using the discrete cosine transform (DCT). In Figure 3a, a speech signal frame consisting of 32 samples is depicted. The corresponding DCT transform with 32 coefficients is shown in Figure 3b. The DCT coefficients are then arranged in descending order and presented in Figure 3c. Furthermore, Figure 3d shows the plot of energy in the largest \(K\) coefficients, where \(K\) takes values of 5, 10, 15, 20, 25, and 30. The plot in Figure 3d demonstrates that the top five DCT coefficients encompass 75.65% of the total energy of the 32 samples in the speech signal frame, while the top ten coefficients capture 95.36% of the total energy. These findings provide empirical evidence that only a small number (five to ten) of coefficients are sufficient to extract the most pertinent information from the complete frame. Therefore, zeroing the non-significant coefficients will produce a sparse signal with minimal information loss.  
Figure 3: Illustration of the process of generating a sparse signal representation using the DCT. Where plot (**a**) shows the sampled speech signal, plot (**b**) shows the amplitudes of its DCT coefficients, plot (**c**) shows DCT coefficients arranged in descending order, and plot (**d**) shows the percentage of total energy contained by the largest \(K\) coefficients, where \(K\) takes values of 5, 10, 15, 20, 25, and 30.  
There are several different iterations of DCT available, typically referred to as DCT-I to DCT-IV. They all have very subtle distinctions amongst one another [52]. Among these four variants, DCT-II is by far the most common and has thus been chosen for this work. The following equation can be used as a general formula for computing the DCT of a one-dimensional signal \(f[n]\) with \(N\) number of samples:  
\[g[k]=\left\{\begin{array}{cc}\Lambda[k]\sqrt{\frac{2}{N}}\sum\limits_{n=0}^{N -1}f[n]\text{cos}\Big{[}\frac{\pi k(2n+1)}{2N}\Big{]},&0\leq k<N\\ 0,&\text{Otherwise}\end{array}\right. \tag{2}\]  
where \(g[k]\) denotes the DCT coefficients vector of length \(N\).  
The IDCT is calculated as:  
\[f[n]=\left\{\begin{array}{cc}\sqrt{\frac{2}{N}}\sum\limits_{k=0}^{N-1} \Lambda[k]g[k]\text{cos}\Big{[}\frac{\pi k(2n+1)}{2N}\Big{]},&0\leq k<N\\ 0,&\text{Otherwise}\end{array}\right. \tag{3}\]  
where \(\Lambda[k]\) is defined as:  
\[\Lambda[k]=\left\{\begin{array}{cc}\frac{1}{\sqrt{2}},&k=0\\ 1,&1\leq k\leq N\end{array}\right. \tag{4}\]