In [1]:
import IPython.display as ipd
ipd.YouTubeVideo('ydu12NfZd90', width=600, height=360)
Out[1]:
Here is how you can create a real-time spectrogram in your terminal using PyAudio.
To see the example in action, run the script in this repo, realtime_spectrogram.py
:
python3 realtime_spectrogram.py
The basic idea is simple. For every new audio buffer,
x_fft
, of the audio buffer.melspectrum
from the x_fft
.s
, where s[i]
is '*'
wherever melspectrum[i]
is above a threshold.From here, you can manipulate this basic example to do more sophisticated real-time processing, e.g. involving machine learning models.