This will however add latency to the pitch estimation for new pitches, because the median filter will have to become half filled with new values before the new one becomes the median value. It is possible to put a median filter of length median on the output estimation so that outliers and jitter can be eliminated. If the pitch frequency is higher than maxFreq, or if no peak is found above minFreq, then hasFreq is set to zero and freq is held at its previous value. The three values around the peak are used to find a fractional lag value for the pitch. Setting maxBinsPerOctave larger will cause the coarse search to take longer, and setting it smaller will cause the fine search to take longer.) (Note that maxBinsPerOctave does NOT affect the final pitch resolution a fine resolution search is always performed. Then a fine resolution search is performed until the peak is found. The autocorrelation is done coarsely at first using a maximum of maxBinsPerOctave lags until the peak is located. Using a peakThreshold of one half does a pretty good job of eliminating overtones, and finding the first peak above that threshold rather than the absolute maximum peak does a good job of eliminating estimates that are actually multiple periods of the wave. (Technically, it's the height of the autocorrelation peak normalised by the height of the zero-lag peak.) It therefore gives a kind of measure of "purity" of the pitched signal. Rather than simply being 1 when a pitch is detected, it is a "clarity" measure in the range between zero and one. If the clar argument is greater than zero (it is zero by default) then hasFreq is given additional detail. It performs an autocorrelation on the input and looks for the first peak after the peak around the lag of zero that is above peakThreshold times the amplitude of the peak at lag zero. If it is not then no pitch estimation is performed, hasFreq is set to zero and freq is held at its previous value. First it detects whether the input peak to peak amplitude is above the ampThreshold. execFreq is clipped to be between minFreq and maxFreq. The pitch follower executes periodically at the rate specified by execFreq in cps. Arguments: in initFreq minFreq maxFreq execFreq maxBinsPerOctave median ampThreshold peakThreshold downSample clar Discussion:
0 Comments
Leave a Reply. |