To see the example in action, run the script in this repo,
The basic idea is simple. For every new audio buffer,
x_fft, of the audio buffer.
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.