All Projects → adefossez → Julius

adefossez / Julius

Licence: mit
Fast PyTorch based DSP for audio and 1D signals

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Julius

Soul
The SOUL programming language and API
Stars: ✭ 1,566 (+774.86%)
Mutual labels:  dsp
Audio Plugin Development Resources
Various resources related to developing plugins for audio production.
Stars: ✭ 136 (-24.02%)
Mutual labels:  dsp
Guitarstack
Digital guitar effects right in your browser!
Stars: ✭ 164 (-8.38%)
Mutual labels:  dsp
Edsp
A cross-platform DSP library written in C++ 11/14. This library harnesses the power of C++ templates to implement a complete set of DSP algorithms.
Stars: ✭ 116 (-35.2%)
Mutual labels:  dsp
Noise reduction
Speech noise reduction which was generated using existing post-production techniques implemented in Python
Stars: ✭ 130 (-27.37%)
Mutual labels:  dsp
Essentia
C++ library for audio and music analysis, description and synthesis, including Python bindings
Stars: ✭ 1,985 (+1008.94%)
Mutual labels:  dsp
Create
Software for the HifiBerry/BeoCreate Re-Create project for upcycling vintage loudspeakers
Stars: ✭ 103 (-42.46%)
Mutual labels:  dsp
Audionetwork
Data transmission over sound waves written in JavaScript without any dependencies. All you need is just microphone, speakers and the browser!
Stars: ✭ 173 (-3.35%)
Mutual labels:  dsp
Jamesdspmanager
Audio DSP effects build on Android system framework layer. This is a repository contains a pack of high quality DSP algorithms specialized for audio processing.
Stars: ✭ 136 (-24.02%)
Mutual labels:  dsp
Resampy
Efficient sample rate conversion in python
Stars: ✭ 155 (-13.41%)
Mutual labels:  dsp
Openssp
openssp
Stars: ✭ 124 (-30.73%)
Mutual labels:  dsp
Frequalizer
Equalizer using JUCE new dsp module
Stars: ✭ 130 (-27.37%)
Mutual labels:  dsp
Nwaves
.NET library for 1D signal processing focused specifically on audio processing
Stars: ✭ 151 (-15.64%)
Mutual labels:  dsp
Vultmodules
A set of modules written in Vult for VCVRack
Stars: ✭ 114 (-36.31%)
Mutual labels:  dsp
Torch Audiomentations
Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning.
Stars: ✭ 164 (-8.38%)
Mutual labels:  dsp
Js Rocks
JS Rocks - Web Audio electric guitar effects and cabinets
Stars: ✭ 106 (-40.78%)
Mutual labels:  dsp
Wavesdr
macOS native desktop Software Defined Radio app
Stars: ✭ 144 (-19.55%)
Mutual labels:  dsp
Shaden
🎧 A modular audio synthesizer.
Stars: ✭ 175 (-2.23%)
Mutual labels:  dsp
Supriya
A Python API for SuperCollider
Stars: ✭ 167 (-6.7%)
Mutual labels:  dsp
Pyaudiodsptools
Numpy Audio DSP Tools
Stars: ✭ 154 (-13.97%)
Mutual labels:  dsp

Julius, fast PyTorch based DSP for audio and 1D signals

tests badge cov badge

Julius contains different Digital Signal Processing algorithms implemented with PyTorch, so that they are differentiable and available on CUDA. Note that all the modules implemented here can be used with TorchScript.

For now, I have implemented:

Along that, you might found useful utilities in:

Representation of the convolutions filters used for the efficient resampling.

News

  • 26/01/2021: julius 0.2.2 released: fixing normalization of filters in lowpass and resample to avoid very low frequencies to be leaked. Switch from zero padding to replicate padding (uses first/last value instead of 0) to avoid discontinuities with strong artifacts.
  • 20/01/2021: julius implementation of resampling is now officially part of Torchaudio.

Installation

julius requires python 3.6. To install:

pip3 install -U julius

Usage

See the Julius documentation for the usage of Julius. Hereafter you will find a few examples to get you quickly started:

import julius
import torch

signal = torch.randn(6, 4, 1024)
# Resample from a sample rate of 100 to 70. The old and new sample rate must be integers, 
# and resampling will be fast if they form an irreductible fraction with small numerator 
# and denominator (here 10 and 7). Any shape is supported, last dim is time.
resampled_signal = julius.resample_frac(signal, 100, 70)

# Low pass filter with a `0.1 * sample_rate` cutoff frequency.
low_freqs = julius.lowpass_filter(signal, 0.1)

# Fast convolutions with FFT, useful for large kernels
conv = julius.FFTConv1d(4, 10, 512)
convolved = conv(signal)

# Decomposition over frequency bands in the Waveform domain
bands = julius.split_bands(signal, n_bands=10, sample_rate=100)
# Decomposition with n_bands frequency bands evenly spaced in mel space.
# Input shape can be `[*, T]`, output will be `[n_bands, *, T]`.
random_eq = (torch.rand(10, 1, 1, 1) * bands).sum(0)

Algorithms

Resample

This is an implementation of the sinc resample algorithm by Julius O. Smith. It is the same algorithm than the one used in resampy but to run efficiently on GPU it is limited to fractional changes of the sample rate. It will be fast if the old and new sample rate are small after dividing them by their GCD. For instance going from a sample rate of 2000 to 3000 (2, 3 after removing the GCD) will be extremely fast, while going from 20001 to 30001 will not. Julius resampling is faster than resampy even on CPU, and when running on GPU it makes resampling a completely negligible part of your pipeline (except of course for weird cases like going from a sample rate of 20001 to 30001).

FFTConv1d

Computing convolutions with very large kernels (>= 128) and a stride of 1 can be much faster using FFT. This implements the same API as torch.nn.Conv1d and torch.nn.functional.conv1d but with a FFT backend. Dilation and groups are not supported. FFTConv will be faster on CPU even for relatively small tensors (a few dozen channels, kernel size of 128). On CUDA, due to the higher parallelism, regular convolution can be faster in many cases, but for kernel sizes above 128, for a large number of channels or batch size, FFTConv1d will eventually be faster (basically when you no longer have idle cores that can hide the true complexity of the operation).

LowPass

Classical Finite Impulse Reponse windowed sinc lowpass filter. It will use FFT convolutions automatically if the filter size is large enough.

Bands

Decomposition of a signal over frequency bands in the waveform domain. This can be useful for instance to perform parametric EQ (see Usage above).

Benchmarks

You can find speed tests (and comparisons to reference implementations) on the benchmark. The CPU benchmarks are run on a Mac Book Pro 2020, with a 2 GHz quadcore intel CPU. The GPUs benchmark are run on Google Colab Pro (e.g. V100 or P100 NVidia GPU). We also compare the validity of our implementations, as compared to reference ones like resampy or torch.nn.Conv1d.

Running tests

Clone this repository, then

pip3 install .[dev]'
python3 tests.py

To run the benchmarks:

pip3 install .[dev]'
python3 -m bench.gen

License

julius is released under the MIT license.

Thanks

This package is named in the honor of Julius O. Smith, whose books and website were a gold mine of information for me to learn about DSP. Go checkout his website if you want to learn more about DSP.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].