Giter VIP home page Giter VIP logo

audio-resampling-in-python's Introduction

Comparison of audio resampling libraries. View the notebook: https://nbviewer.jupyter.org/github/jonashaag/audio-resampling-in-python/blob/master/Audio%20Resampling%20in%20Python.ipynb

Best by quality

  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

Best by speed

Downsampling from 48 kHz to 44.1 kHz.

Library Time on CPU Time on GPU
soxr 1.16 ms no support
scipy.signal.resample 2.42 ms no support
lilfilter 4.23 ms ?
torchaudio (transforms.Resample) 9.98 ms ?
torchaudio (resample_waveform) 10 ms ?
resampy ("kaiser_fast") 10.5 ms no support
nnresample 16 ms no support
julius 16.2 ms ?
resampy ("kaiser_best") 44.8 ms no support
scikits.samplerate 75.5 ms no support
samplerate 76.8 ms no support

audio-resampling-in-python's People

Contributors

dofuuz avatar jonashaag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

audio-resampling-in-python's Issues

torchaudio resampling bug in notebook and updates

Hi @jonashaag, thanks for compiling and updating this notebook on resampling libraries! However, I noticed there was a small bug in the new torchaudio examples, and also wanted to update you on some new resampling capabilities from our latest release.

I noticed that there was a bug in the notebook with the torchaudio_new_resample arguments that led to it producing strange plots for both the upsample and downsample examples. Removing [None] and [0] from torchaudio_new_resample(torch.from_numpy(sig[None]), P, Q).numpy()[0] should resolve this issue, and both resampling methods in torchaudio should produce the same results.

In the latest torchaudio release (v0.9.0), we made several improvements to resampling. We improved the speed performance of transforms.Resample, deprecated kaldi.resample_waveform in favor of functional.resample, added kaiser window support, among others. If you're interested, you can track the updates here, and we have also created a tutorial demonstrating the properties of our improved resampling function.

What are your thoughts on the following?

  • fixing the torchaudio_new_resample bug
  • using the latest version of torchaudio (0.9.0) (Note that for the latest version,transforms.Resample should take in an additional dtype=torch.float64 argument in your examples)
  • plotting with a higher quality set of parameters (ex/ using lowpass_filter_width=64 or resampling_method="kaiser_window")

Let me know if you would like to work on this, or if you'd like me to send in a PR, I'd be happy to do so as well!

cc @mthrok

Impulse comparison: order of arguments wrong for Julius

Hi @jonashaag , I was looking at the impulse response and trying to understand why it was looking so wrong with Julius, and why so little attenuation was present above the old Nyquist frequency.

Well, it seems you gave the arguments in the wrong order for Julius, it should be old_sr, new_sr, just as resampy, but you passed the opposite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.