Padding with Zeros


Motivation

Because we are dealing with short signals, and the frequency resolution of the FFT is inversely proportional to the length of the signal, there is a limit to how small our frequency resolution can be. We are using an n of 4096 samples, which correponds to a T of 0.09 seconds. This T means our frequency resolution is 11 Hz.

The FFT assumes that the signal it operates on is periodic. We can add length to the signal by adding a bunch of zeros on the end. This may seem like cheating, but in reality it's simply treating the signal as if the short burst is followed by silence, and that whole thing (burst and silence) is repeated on to infinity. Adding zeros to the end effectively allows us to increase the frequency resolution arbitrarily. However, we must make sure that we are still getting a reasonable approximation of the actual note.

Example

Below is an FFT of the F Sharp played legato with vibrato from the first page. The blue line shows the FFT with n=4096. The red line shows the FFT of those 4096 samples with an additional 4096 zeros added on to the end.

The overall shape looks about the same in both cases. To get a better idea of what adding the zeros did, lets zoom in on the first peak.

Zooming in shows that the red line does indeed have twice as many points as the blue line. However, the width of the peak is approximately the same in both cases. For us, this means that padding our samples with zeros is not going to yield more useful information than simply performing the FFT on the unpadded signal.

Conclusion

Padding with zeros, though a standard practice and useful in many applications, does not appear to significantly improve our data in this application. Though we have twice the frequency resolution, it's not yielding any better data. Quick tests padding with many more zeros (1 part sample, 9 parts zeros) show that though the peaks get rounder due to better frequency resolution, the discrepancy between the highest point on the original sample and the highest point on the padded sample is 1 Hz at most, which means that it is probably not worth the effort, even at low frequencies.

BACK NEXT