juanmc2005 / diart

A python package to build AI-powered real-time audio applications
https://diart.readthedocs.io
MIT License
1.02k stars 87 forks source link

Switch to a faster library for dynamic resampling #190

Open juanmc2005 opened 11 months ago

juanmc2005 commented 11 months ago

Looks like torchaudio.Resample is not very fast compared to other libraries implementing resampling in python.

See https://github.com/jonashaag/audio-resampling-in-python

Looks like we could switch to soxr and get a 10x speed increase.

pnocera commented 11 months ago

hi Juan. I found a cheap way to avoid resampling if you're using pipewire is to force the rate with

pw-metadata -n settings 0 clock.force-rate 16000

that's for microphone reording.

There's also an aubio library which provides resampling. It provides a python module

https://aubio.org/doc/latest/synth_2test-sampler_8c-example.html