# Smart-Median: A New Real-Time Algorithm for Smoothing Singing Pitch Contours
## 2 Materials and Methods
### Pitch Detection Algorithms to Generate Pitch Contours  
To evaluate the proposed smoother algorithm, we used a similar approach as [1], employing several pitch contours with different random error (unsmoothed) points. As [PERSON] and [PERSON]'s [5] study discussed, six real-time pitch detection algorithms with different estimated contours were employed to obtain the required contours. The pitch detector algorithms were Yin [25], spectral YIN or YIN Fast Fourier transform (YinFFT), Fast comb spectral model (FComb), Multi-comb spectral filtering (Mcomb), Schmitt trigger, and the spectral auto-correlation function (specacf). The implementation for these algorithms came from a Python library, Aubio ([[https://aubio.org/manual/latest/cli.html#aubiopitch](https://aubio.org/manual/latest/cli.html#aubiopitch)]([https://aubio.org/manual/latest/cli.html#aubiopitch](https://aubio.org/manual/latest/cli.html#aubiopitch)), accessed on 10 June 2021) [26], a well-known library for music information retrieval. Since the focus of this paper is on smoothing pitch contours, descriptions of these algorithms are not provided in this paper but can be found in [5; 27]. The reason for selecting these real-time pitch estimators was that, based on the study by [PERSON] and [PERSON] [5], none of them can estimate F0s without error in singing signals. In addition, the accuracy of these algorithms varies, which helped us evaluate the contour-smoother algorithms in different situations.  
In addition, to compare the accuracy of the algorithms in conditions where the pitch contours included no or only a few errors, an offline pitch-detector algorithm provided in the Praat tool [28] based on the Boersma algorithm [29] was used. According to [PERSON] and [PERSON]'s studies [4; 5], the Praat and Pyin accuracies tend to be similar.  
The settings used for pitch detection for women's voices were 44,100 for sample rate, 1024 for window size, and 512 for hop size. The related settings for men's voices were 44,100, 2048, and 1024 for sample rate, window size, and hop size, respectively. Therefore, the distance between two consecutive points in a pitch contour for women's voices was 11.61 milliseconds, and for men's voices was 23.22 milliseconds.  
As shown in Figure 1, the contours generated by the different pitch detectors exhibited various errors. Therefore, the total number of contours used to evaluate the smoother algorithms was 2682 (corresponding to the six pitch detectors run on each of the 447 wav files).  
Figure 1: Pitch contours for a female singer of arpeggios in the C scale. (**a**) pitch contour estimated by Pyin (ground truth), Praat, Yin, and YinFFT algorithms. (**b**) pitch contour estimated by Pyin (ground truth), Fcomb, Schmitt, Mcomb, and Speca  
All the provided files, such as the dataset and codes, are available in a GitHub repository at [[https://github.com/BehnamFaghiMusicTech/Smart-Median](https://github.com/BehnamFaghiMusicTech/Smart-Median)]([https://github.com/BehnamFaghiMusicTech/Smart-Median](https://github.com/BehnamFaghiMusicTech/Smart-Median)), accessed on 6 July 2022.