Cornell University ECE4760
Voice Spectrogram by short-term FFT
Pi Pico RP2040
Spectrogram -- Audio rate
The VGA routines were used to construct an oscilloscope-like display of an ADC channel connected to a microphone. The raw waveform is displayed, plus the power spectrum, the approximate log-power spectrum, and the spectrogram. Core 0 handles the data aqusition and display. Core 1 does the FFTs and handles the serial terminal. The ADC acquires 512 samples at 16 KHz. This rate and window length is about right for speech spectrum (100-3500 Hz). The code computes the FFT bin with peak energy and displays it in the upper left corner. The serial interface starts/stops the data acqusition. The spectrogram shows about 20 seconds of 32 mSec, non-overlapped, sample windows. The code uses two interesting approximations. The first is the alpha-max, beta-min algorithm to speed up square root of sum-of-squares. It is accurate to within 6%. The second is an approximation of log base two from Generation of Products and Quotients Using Approximate Binary Logarithms for Digital Filtering Applications, IEEE Transactions on Computers 1970 vol.19 Issue No.02. It is accurate to within 0.2 log units and is represented is a weird u4x4 fixed point format. The resulting 8-bit log is accurate enough for plotting.
Copyright Cornell University June 9, 2023