Summary: This module investigates the use of Matlab filters to determine when notes are played within a recording from an electric guitar.
In order to determine the speed at which the user is playing it is first necessary to determine where in the recording individual notes are plucked. When a note is played on the guitar, a sharp peak occurs which is then followed by a decay as the vibrations in the string dampen. To determine where these edges occur the signal is first low pass filtered to remove some of the noise, then it is convolved with an edge detector function which produces a signal with peaks located at large edges (where notes are played).
Due to the non-uniform qualities of guitar waveforms, an edge detector function with rounded edges produced the best results. A good function to use for an edge detector function is the derivative of a Gaussian. This produces a filter that can be tuned to work well with certain frequencies specific to the instrument being tested.
| Derivative of a Gaussian |
|---|
![]() |
After the original signal is convolved with the Gaussian edge detector the result is a signal with peaks located where edges occurred in the original signal. A simple algorithm is used to create a vector of zeros with ones located at the locations of the peaks. Due to the nature of the guitar signal, it is not uncommon for the convolved signal to contain "double peaks" where two or more closely spaced peaks are created to represent what should be considered a single edge. To accommodate for this error, the algorithm is designed that once it finds a peak, it ignores any other peaks that occur within a given threshold range.
| Orignal Signal and Convolved Signal |
|---|
![]() |
| Location of Edges |
|---|
![]() |
To use the information produced by the edge detection to determine how fast the user is playing, the vector of ones and zeros representing peak locations is windowed into equal length chunks. The values within each of these chunks are summed together to determine the number of notes played within that window of time. From this, the program can determine whether the user was playing fast or slow during that period of time based on whether the number of notes played is above or below a previously decided threshold.