# Demystifying DFT-Based Harmonic Phase Estimation, Transformation, and Synthesis
## 1 Introduction
### A Practical Approach to Harmonic Signal Processing  
The problem we address falls within the realm of spectrum estimation using Fourier analysis. Given our aim for practical signal processing that is suitable for real-time operation on low-cost platforms, we highlight simple technical approaches that utilize the discrete Fourier transform (DFT). This choice allows for the benefit of efficient realization algorithms (e.g., the FFT [15]). In addition, we exclude non-causal or iterative processing in order to accommodate real-time operation on low-cost platforms. Thus, in a practical setting, simple spectrum estimation typically implies three operations: (1) sampling, (2) time-frequency (T-F) transformation, and (3) frequency, magnitude, as well as phase estimation:  
1. A discrete-time version of the signal represented by Equation (1) is first obtained using a convenient sampling frequency (\(F_{S}\)), i.e., we have the following: \[x[n]=x(t)|_{t=nT_{S}=\frac{n}{F_{S}}}\,\] (3) where \(T_{S}\) represents the sampling period and corresponds to the reciprocal of the sampling frequency (\(F_{S}\)). 2. A T-F transformation (using e.g., the DFT) is computed on a windowed region of the discrete-time signal containing \(N\) samples. We assume that \(N\) is a power of two numbers. If the window is represented by \(w[n]\) (and we assume is symmetric), this means that, in the case of the DFT, we compute the following: \[X[k]=\sum_{n=0}^{N-1}x[n]w[n]e^{-j\frac{2\pi}{N}kn},\ k=0,1,\ldots,N-1\,\] (4) where \(j=\sqrt{-1}\). 3. Finally, a suitable estimation procedure is used that takes the spectral coefficients, \(X[k]\), as input and delivers robust estimates of all the harmonic frequencies, magnitudes, and phases. These simple spectrum estimation steps enable the identification of important harmonic parameters such as the normalized fundamental frequency, \(\omega_{0}=\Omega_{0}T_{S}\). On the other hand, if the parametric representation of harmonic magnitudes and phases is done in such a way that it does not depend on time or the fundamental frequency, it paves the way for a harmonic signal processing paradigm that promotes simplification, flexibility, and even insight in algorithms. In fact, in many applications, such as speech enhancement and time-scale or pitch-scale modification of speech [3], and special effects in singing and music [2], harmonic sinusoidsare individually modified in terms of their frequency, magnitude, and phase trajectories, as suggested by Figure 1.  
However, this approach requires careful unwrapping of the phases of all harmonics such that their modifications are correct and do not suffer from the errors that may result from the wrapped phase representation in the interval \([-\pi,\pi]\). In addition, phase unwrapping, which is carried out for all harmonics on an individual basis and in a 'horizontal' manner, i.e., along the time axis, is itself prone to estimation errors. The most critical aspect of this approach, however, is that it is not insightful, i.e., it does not capture the overall, or holistic, harmonic phase structure, which means that, most likely, it does not explicitly control it. As a result, although phase coherence may be obtained on an individual sinusoidal basis,'vertical' coherence may not be controlled and artifacts may result, the most common being known as 'phasiness' [16]. A more convenient paradigm in harmonic signal processing is represented by the block diagram illustrated in Figure 2.  
According to this paradigm, harmonic magnitude and phase models are extracted that represent the holistic harmonic structure (or'vertical' structure) in a way that is time-shift invariant, and independent of the fundamental frequency. This approach not only promotes insight into the harmonic signal structure but also greatly facilitates signal transformation. For example, the magnitude model (MM) and the phase model (PM) may change arbitrarily or may be interpolated in simple ways.