bernardo-torres / audio-resampling-in-python

Comparison of Python audio resampling implementations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comparison of audio resampling libraries and some audio loaders.

View the two notebooks:

Best by speed (resampling only)

Downsampling from 48 kHz to 44.1 kHz.

Library Time on CPU
torchaudio_hann 0.87 ms
torchaudio_transform_hann 1.11 ms
torchaudio_transform_kaiser 1.38 ms
soxr 1.43 ms
torchaudio_kaiser 1.69 ms
scipy 2.40 ms
julius 9.21 ms
resampy_fast 13.63 ms
nnresample 18.33 ms
resampy_best 38.04 ms

Best by speed (loading + resampling)

Load Library Resampling Library Time on CPU
torchaudio-sox_io torchaudio_hann 26.42 ms
torchaudio-soundfile torchaudio_hann 27.05 ms
torchaudio-sox_io torchaudio_kaiser 27.65 ms
torchaudio-soundfile torchaudio_kaiser 27.15 ms
scipy soxr 28.06 ms
torchaudio-sox_io soxr 37.96 ms
torchaudio-soundfile soxr 38.00 ms
torchaudio-soundfile julius 39.17 ms
librosa soxr 39.24 ms
soundfile soxr 42.83 ms

Best by quality (resampling only)

  1. Good:
    • scikit.samplerate/scikits-samplerate/samplerate/libsamplerate
    • librosa/resampy ("kaiser_best")
    • julius
  2. Acceptable:
    • nnresample
    • lilfilter
    • torchaudio (transforms.Resample + resample_waveform)
    • librosa/resampy ("kaiser_fast")
  3. Bad:
    • scipy.signal.resample

Please check plots in the Audio Resampling in Python.ipynb notebook. This version is an updated version of the original notebook but does not have all the libraries tested in the original notebook.

About

Comparison of Python audio resampling implementations


Languages

Language:Jupyter Notebook 100.0%