# Digital Signal Processing of the Inharmonic Complex Tone
## 2 DSP Algorithms Used for the Analysis of String Instruments' Recordings
### The Short-Time Fourier Transform  
The single tone musical signal is a non-stationary signal. For these types of signals, analysis is typically performed frame by frame. The frame-by-frame processing is included in the proposed application, basically for the time-dependent spectrum estimation.  
The Short-Time Fourier Transform (STFT) is used for spectral analysis [1]:  
\[\begin{array}{l}X_{STFT}\left(p,e^{i\omega}\right)=\sum\limits_{k=-\infty}^ {\infty}x[k]w[k-pR]e^{-i\omega k}\\ \sum\limits_{l=0}^{L-1}x[l+pR]w[l]e^{-i\omega(l+pR)},\end{array} \tag{13}\]  
where \(w[l]\), \(l=0\), \(1\), \(\ldots\), \(L-1\) is the window function of the length \(L\), \(p\) is the frame index, and \(R\) (in samples) is the shift of the successive frames. The expression can be transformed into a form:  
\[X_{STFT}\left(p,e^{i\omega}\right)=e^{-i\omega pR}\sum\limits_{l=0}^{L-1}x[l+pR ]w[l]e^{-i\omega l}. \tag{14}\]  
And it can be implemented by the Discrete Fourier Transform (DFT) of each frame as follows:  
\[X_{STFT}[p,q]=e^{-j}\frac{q}{2\pi}p^{R}\sum\limits_{l=0}^{L-1}x[l+pR]w[l]e^{- j}\frac{q}{2\pi}l,\;q=0,1,\ldots N_{fft}-1, \tag{15}\]  
where \(N_{fft}\) is the length of the DFT. If it is set to a value greater than \(L\), the time array is zero-padded. Throughout this paper, the term STFT is used for the time-dependent analysis, and the term DFT is used for a single frame or the whole-length signal.  
Currently, two types of window functions are supported: Hann and Blackman-Harris. The parameter \(R\) is chosen based on the Constant Overlap--Add (COLA) condition [1]:  
\[\begin{array}{l}\sum\limits_{p=-\infty}^{\infty}X_{STFT}\left(p,e^{i\omega} \right)=\sum\limits_{p=-\infty}^{\infty}\sum\limits_{l=0}^{L-1}x[k]w[k-pR]e^{ -i\omega k}=\\ \sum\limits_{k=-\infty}^{\infty}x[k]e^{-i\omega k}\left(\sum\limits_{p=-\infty }^{\infty}w[k-pR]\right)^{\sum\limits_{p=-\infty}^{\infty}w[k-pR]=1,\;for\; each\;k}=X\big{(}e^{i\omega}\big{)}.\end{array}, \tag{16}\]  
In the current version of the application, it is set to 0.125 because for that value, the condition (16) is satisfied for both supported window functions. In the current form of the application, the inverse STFT is not used, and for that reason, the COLA condition does not have the full meaning. However, if the additional modules relying on the inverse STFS are included, this issue will be considered more carefully.  
In the presented application, the overlapping DFT series is used for the visualization instead of the spectrogram that is typically used. The reason is that the STFT is only calculated for a limited number of frames and used to track the frequency glide of the signal's partials. If the window length is set to achieve good time resolution, that is usually not good enough for satisfactory resolution in the frequency domain. For the detection of the positions of maximum values of the channel signal's spectrum, the zero padding improves the result; however, that does not resolve the resolution problem, i.e., the components close in spectrum are difficult to resolve.