Skip to content

Realtime Analysis

SkySHERRY edited this page Apr 14, 2022 · 6 revisions

Audio Input

The I2S mic would constantly read the audio data into pi, it is designed to have low-latency audio data. The hardware buffer on the sound card storess recorded samples. When the buffer is sufficiently full, it generates an interrupt. The kernel sound driver then uses direct memory access (DMA) to transfer samples to an application buffer in memory.

The driver program needs to be running in an endless loop to read the data. Actually, it reads into a buffer which has size of 1024 bytes to make sure it is enough to use FFT calculation. While based on Nyquist theory, the largest frequency that can be detected in our case is 512Hz which fits the frequencies range of standard tuning.

Mouse click

While the mouse could click the button on the Qt button, when it is clicked, the standard tuning pitch is changed for specific string. Qt runs in main thread.

frequency spectrum display

When reading data into a buffer, the FFT happend and results outputs to Qt to display the spectrum. The frequency spectrum has been low passed to avoid potential harmonics.

performance

When user hits the guitar string, the resulted spectrum is shown. The thermo shows whether you should loose or tighten your string, (real - expect) calculation is shown.

Clone this wiki locally