The Real-Time Pitch Detect System

Erich Zimmerman, Dean Berg, Prof. John Sahr


INTRODUCTION

The following is a description of the process flow of a program written in MATLAB script. The program calculates various parameters (pitch, location and value of maximum points, signal on/off indicator, volume, etc.). The pitch and maximum point information are rough estimates which are passed on to software routines which make a more precise estimation of the parameters.


PROCESS/PROGRAM FLOW

The program starts out by filtering the guitar signal with a median filter. The median filter conditions the signal using a five sample sliding window. This is a non-linear filter which takes out the spurious spikes without degrading the response of the signal. To begin the control part of the program, it is looking for the attack or start of a valid guitar signal versus noise only. It is assumed at equipment power-up, that noise only is present. A noise threshold is continuously being established while a valid guitar signal is not present. The noise threshold parameter is established by calculating signal offset, standard deviation, maximum point values. Refer to Figure 1. The result is that the noise threshold value hovers over the noise signal, slightly delayed, following the noise signal variations until there is an abrupt signal change (attack signal).


FIG. 1


Once an attack is detected, the program will look for a maximum peak point. Refer to Figure 2. The program will determine the maximum peak point of the current cycle (period) by using pass peak point information and signal characteristics (slope, value, change in slope). The program follows the signal in real time and determines the peak point, it doesn't pick out a window of points and then find the maximum point.


FIG. 2


Next, the program is looking for the next cycle of the signal. If the next cycle is not found by the time period restriction (< 15ms), the program will start over looking for an attack and establishing a noise threshold. The program uses past peak point value change information to set a threshold to find the next cycle of the signal. If a next cycle is found, the program starts looking for a peak point. The threshold curves are expotential curves. Refer to Figure 3. They are used to help avoid spurious peaks which occur from harmonics and have the tendency to build up toward the end of an attack signal. The smaller the variation of peak values, the smaller the slope of the threshold curve.


FIG. 3


This means the parameters calculated are reported and saved in a file in real time. The attack and first pitch estimates are reported with only a single or few sample delays. The pitch and volume are calculated over one pitch period.


FIG. 4


FIG. 5


The peak value and pitch information is used to make note change decisions. If the new peak values are greater than the old peak values, or there is a large arbitrarily set( >10 percent) change in pitch in one cycle, means a note change.


FIG. 6


CONCLUSIONS

The program works fairly well, but has some flaws. The program execution is fast. The program was written in a format to easily be converted to 'C' or another procedure type high level language. There are some discreprencies with how the program works and more testing is needed. There is a problem with the calculation of volume at the end of the attack signals. Also, there are some program parameters which need to be tuned to prevent incorrect identification of peak points.


RECOMMENDATIONS

  • 1) Calculate volume for a fixed window size.
  • 2) Look at signal variance between previous peak points to help establish the threshold curve used in finding the next pitch cycle.
  • 3) Establish and use pitch information found in the noise signal at power up to establish the threshold curve used in finding each pitch cycle.
  • 4) Do more testing using a wider variety of signal test cases.
    Electrical Engineering Department
    University of Washington
    Box 352500
    Seattle, WA 98195-2500 USA
    ejz@ee.washington.edu
    dberg@ee.washington.edu