# Singing Transcription from Polyphonic Music Using Melody Contour Filtering
## 2 Melody Extraction
### Construct Salience Spectrogram  
In this section, we reconstruct the entire energy frequency distribution by constructing a salience graph. Similar to the salience function [29] in some classical algorithms, the energy of the higher harmonics is accumulated downward in an attempt to enhance the energy of the fundamental frequency. Next, we convert the instantaneous frequency into a MIDI pitch. In order to better match the auditory range of the human voice, we set the pitch range to five octaves from A1 to A6, where the singing voice is at an effective level, which is divided into 60 semitones. Analogous to the salience function used by [PERSON] [17], we covered the frequency range from 55 to 1760 Hz, implying that our bin range was from 11 to 352, while the quantization range was reduced by a factor of 10. According to the human auditory effect, to judge the standard of a pitch change when the fluctuation of adjacent frames is more than a specific threshold, a new note appears. Similarly, the difference in pitch between adjacent peaks is allowed to be within one semitone, which is analogous to the distance between adjacent pixels on the edge of an image. It is this pitch difference that is an important indicator for distinguishing between melodic contours. Therefore, in analyzing melodic properties, we classify pitches as semitones. Our formula for obtaining the relevant MIDI pitch for each peak point of each frame of \(\widetilde{l}_{k}\) is as follows:  
\[B\left(\widetilde{l}_{k}\right)=12 log\left(\frac{\widetilde{l}_{k}}{55} \right)+0.1 \tag{7}\]  
After the frequency is converted to a MIDI pitch, we use the salience function to conduct a down-scaling superposition of the octave at the peak point \(\widetilde{l}_{k}\). The energy of the high-order harmonic superposition gradually decreases with the increase in harmonic frequency. The equation is as follows:  
\[F(\tau)=\sum_{k=1}^{I}\ \sum_{h=1}^{N}\left\{ \begin{matrix}\widetilde{l}_{k}cos^{2 }\left(\frac{\pi}{2}\delta\right)\alpha^{h-1},&if\ |\delta|\leq 1\\ &0,&else\end{matrix} \right. \tag{8}\]  
where \(\delta=\left|B\left(\frac{\widetilde{l}_{k}}{h}\right)-\tau\right|\); \(I\) corresponds to 60 bins; N represents the count of harmonics; the experimental result is 10; \(\tau=1,\ 2,\ 3\ldots\); and \(\alpha\) is the parameter of the high-order harmonic attenuation coefficient, which is chosen as 0.8. The judgment condition represents \(\widetilde{l}_{k}\), the condition that the absolute value of the pitch difference between each octave of the peak point and the fundamental frequency is less than a semitone. The obtained peak energy is taken as the cosine change multiplied by the power of the number of harmonics. The cosine function means that the result of the corresponding salient function is a fluctuation distribution, which is conducive to the superposition between peak values, and it increases the convenience of our later contour search problems. The result also shows a remarkable effect in terms of finding the potential fundamental frequency and dealing with the misjudgment caused by octave error. The superimposing of harmonic energy can also effectively increase the energy at some peak points, stabilize and enhance the energy distribution of the system, and contribute to the accuracy of detecting a singing voice. Through further analysis of a large number of graphs, the energy contained in the low-frequency region has a magnitude range substantially higher than most of the medium-frequency regions. In order to maintain the relative balance of bands in different frequency domains, we use a Gaussian weighting function for each frame to reduce the energy in the low-frequency region. \[G(\tau)=F(\tau)e^{-\delta\left(\frac{\tau}{1}-0.5\right)^{2}} \tag{9}\]  
where \(k=0,\ 1,\ 2\ldots\) and \(\delta=3.3\); weighting the low-frequency harmonics separately is helpful for enhancing the fundamental frequency result, allowing us to effectively control the overall realization of low-frequency suppression.