Audio is capture from the microphone and plotting the wave form in time and frequency domain.
Run on terminal:
git clone https://github.com/luizcarloscf/audio-stream.git
cd audio-stream
./bootstrap.sh
python3 src/main.py
For more informations about what can be configurated just run:
python3 src/main.py --help
The audio is capture from the microphone using a python package PyAudio on a thread. PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library.
The audio analysis to get the data on frequency domain is compute by the Fast Fourier Transform.
The discrete Fourier transform (DFT) is a mathematical technique used to convert temporal or spatial data into frequency domain data. The DFT, is defined as:
The FFT is a fast algorithm to compute the DFT. It's possible to divide the DFT computation into two smaller parts. From the definition of the DFT we have:Based on the conclusion above, we design a algorithm to compute the FFT.
Create a plotting figure using matplotlib.
Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms
The plotting figure show the audio that is being captured and the spectrum.
To install the dependencies on Ubuntu, just run:
./bootstrap.sh