Librosa: Real time analysis

Created on 11 Jul 2015  路  3Comments  路  Source: librosa/librosa

Is it (or will be) possible to use Librosa to make real-time audio analysis, reading the audio not from a file but from a stream (like from Jack on Linux or from a sound card input)?

Probably it can be done working on little frames of some thousands of samples, but I have no idea of time needed for processing and if it can be done at a decent rate...

question

Most helpful comment

Sure. The simplest thing right now is to use PyAudio to generate audio frames and use a callback to do the analysis. This works, but the latency can be pretty bad, and you may end up dropping frames. Depending on your application, it may be good enough: see this post for an example.

One issue here is that not every analysis method is amenable to streaming applications. But simple frame-based analysis should work.

This won't work with librosa.load due to its use of audioread on the backend. (See #140 .) But as long as you can get audio data into a numpy array somehow, it should be fine.

All 3 comments

Sure. The simplest thing right now is to use PyAudio to generate audio frames and use a callback to do the analysis. This works, but the latency can be pretty bad, and you may end up dropping frames. Depending on your application, it may be good enough: see this post for an example.

One issue here is that not every analysis method is amenable to streaming applications. But simple frame-based analysis should work.

This won't work with librosa.load due to its use of audioread on the backend. (See #140 .) But as long as you can get audio data into a numpy array somehow, it should be fine.

Ok, thanks!

There is an option called librosa.stream but not sure whether it can fit into pyaudio applications!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Magurosenbei picture Magurosenbei  路  3Comments

juanbraga picture juanbraga  路  3Comments

MartinDelille picture MartinDelille  路  3Comments

GPrathap picture GPrathap  路  3Comments

mvollrath picture mvollrath  路  4Comments