• Stars
    star
    226
  • Rank 176,514 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Differentiable audio signal processors in PyTorch

dasp

Differentiable audio signal processors in PyTorch

  Includes reverberation, distortion, dynamic range processing, equalization, stereo processing.

  Enables virtual analog modeling, blind parameter estimation, automated DSP, and style transfer.

  Batching with operation on both CPU and GPU accelerators for fast training and reduced bottlenecks.

  Open source and free to use for academic and commercial applications under Apache 2.0 license.

Installation

pip install dasp-pytorch

Or, for a local installation.

git clone https://github.com/csteinmetz1/dasp-pytorch
cd dasp-pytorch
pip install -e .

Examples

dasp-pytorch is a Python library for constructing differentiable audio signal processors using PyTorch. These differentiable processors can be used standalone or within the computation graph of neural networks. We provide purely functional interfaces for all processors that enable ease-of-use and portability across projects. Unless oterhwise stated, all effect functions expect 3-dim tensors with shape (batch_size, num_channels, num_samples) as input and output. Using an effect in your computation graph is as simple as calling the function with the input tensor as argument.

Quickstart

Here is a minimal example to demonstrate reverse engineering the drive value of a simple distortion effect using gradient descent.

Try it for yourself: Open In Colab

import torch
import torchaudio
import dasp_pytorch

# Load audio
x, sr = torchaudio.load("audio/short_riff.wav")

# create batch dim
# (batch_size, n_channels, n_samples)
x = x.unsqueeze(0)

# apply some distortion with 16 dB drive
drive = torch.tensor([16.0])
y = dasp_pytorch.functional.distortion(x, sr, drive)

# create a parameter to optimizer
drive_hat = torch.nn.Parameter(torch.tensor(0.0))
optimizer = torch.optim.Adam([drive_hat], lr=0.01)

# optimize the parameter
n_iters = 2500
for n in range(n_iters):
    # apply distortion with the estimated parameter
    y_hat = dasp_pytorch.functional.distortion(x, sr, drive_hat)

    # compute distance between estimate and target
    loss = torch.nn.functional.mse_loss(y_hat, y)

    # optimize
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    print(
        f"step: {n+1}/{n_iters}, loss: {loss.item():.3e}, drive: {drive_hat.item():.3f}\r"
    )
    

For the remaining examples we will use the GuitarSet dataset. You can download the data using the following commands:

mkdir data
wget https://zenodo.org/records/3371780/files/audio_mono-mic.zip
unzip audio_mono-mic.zip
rm audio_mono-mic.zip

More examples

Audio Processors

Audio Processor Functional Interface
Gain gain()
Distortion distortion()
Parametric Equalizer parametric_eq()
Dynamic range compressor compressor()
Dynamic range expander expander()
Reverberation noise_shaped_reverberation()
Stereo Widener stereo_widener()
Stereo Panner stereo_panner()
Stereo Bus stereo_bus()

Citations

If you use this library consider citing these papers:

Differentiable parametric EQ and dynamic range compressor

@article{steinmetz2022style,
  title={Style transfer of audio effects with differentiable signal processing},
  author={Steinmetz, Christian J and Bryan, Nicholas J and Reiss, Joshua D},
  journal={arXiv preprint arXiv:2207.08759},
  year={2022}
}

Differentiable artificial reveberation with frequency-band noise shaping

@inproceedings{steinmetz2021filtered,
  title={Filtered noise shaping for time domain room impulse 
         response estimation from reverberant speech},
  author={Steinmetz, Christian J and Ithapu, Vamsi Krishna and Calamia, Paul},
  booktitle={WASPAA},
  year={2021},
  organization={IEEE}
}

Differentiable IIR filters

@inproceedings{nercessian2020neural,
  title={Neural parametric equalizer matching using differentiable biquads},
  author={Nercessian, Shahan},
  booktitle={DAFx},
  year={2020}
}
@inproceedings{colonel2022direct,
  title={Direct design of biquad filter cascades with deep learning 
          by sampling random polynomials},
  author={Colonel, Joseph T and Steinmetz, Christian J and 
          Michelen, Marcus and Reiss, Joshua D},
  booktitle={ICASSP},
  year={2022},
  organization={IEEE}

Acknowledgements

Supported by the EPSRC UKRI Centre for Doctoral Training in Artificial Intelligence and Music (EP/S022694/1).

           

More Repositories

1

ai-audio-startups

Community list of startups working with AI in audio and music technology
1,543
star
2

auraloss

Collection of audio-focused loss functions in PyTorch
Python
731
star
3

pyloudnorm

Flexible audio loudness meter in Python with implementation of ITU-R BS.1770-4 loudness algorithm
Python
635
star
4

steerable-nafx

Steerable discovery of neural audio effects
Jupyter Notebook
201
star
5

micro-tcn

Efficient neural networks for analog audio effect modeling
Python
150
star
6

ronn

Randomized overdrive neural networks
Jupyter Notebook
137
star
7

wavebeat

End-to-end beat and downbeat tracking in the time domain.
Python
118
star
8

pymixconsole

Headless multitrack mixing console in Python
Python
116
star
9

AutomaticMixingPapers

Important papers and associated code on automatic mixing research
HTML
102
star
10

automix-toolkit

Models and datasets for training deep learning automatic mixing models
Python
95
star
11

IIRNet

Direct design of biquad filter cascades with deep learning by sampling random polynomials.
Python
83
star
12

NeuralReverberator

Reverb synthesis via a spectral autoencoder
Python
80
star
13

flowEQ

β-VAE for intelligent control of a five band parametric EQ
MATLAB
67
star
14

bela-zlc

Zero-latency convolution on Bela platform
C++
26
star
15

MixCNN

Convolutional Neural Network for multitrack mix leveling
Python
18
star
16

neural-2a

Neural network model of the analog LA-2A dynamic range compressor
CMake
17
star
17

findio

The Spotify search you don't need and never wanted
HTML
13
star
18

computational-music-creativity

Materials for the Computational Music Creativity course at UPF-MTG (Spring 2020)
TeX
12
star
19

PhaseAnalyzer

C++ plugin built with the JUCE Framework to provide insight about the relative phase relationship of audio signals
C++
10
star
20

pyloudnorm-eval

Evaluation of a number of loudness meter implementations
Python
10
star
21

Cinuosity

Novel playlist generation and music discovery in Spotify
JavaScript
9
star
22

mids

Implementation of content-based audio search algorithm.
Python
8
star
23

auxCord

Sync Spotify accounts to build tailored playlists
JavaScript
7
star
24

youtube-audio-dl

Utility to automate download and normalization of YouTube audio streams
Python
6
star
25

amida

audio mixing interface for data acquisition
Python
5
star
26

pyreqs

Easily build requirements.txt files automatically
Python
4
star
27

machine-learning

Materials for the Machine Learning course at UPF-MTG (Winter 2019)
Jupyter Notebook
4
star
28

consynthance

Studying consonance as a result of vocal similarity
Jupyter Notebook
4
star
29

arte

generative artwork created with canvas-sketch
JavaScript
3
star
30

LDA-Music

LDA topic modeling of raw audio data for music suggestions
Python
3
star
31

ML4AP

Slides for my talk Applications of machine learning for assistive and creative audio plugins
JavaScript
3
star
32

cavae

Covert art variational autoencoder for generating new cover art
Python
3
star
33

aes-presenters-145th

Analysis of papers and presenters at the 145th AES Convention in NYC
Python
2
star
34

AudioTechTalks-S19

Materials and associated code for audio technology talks at Clemson University - Spring 2019
JavaScript
2
star
35

aes-stats-147th

Analysis of papers from the 147th AES Convention in NYC
Python
2
star
36

macOS-laptop

Setup script for config and installation on a fresh macOS machine
Shell
2
star
37

tempnetic

Tempo estimation
Python
2
star
38

sBucket

Build large Spotify playlists using user top tracks and seed track recommendations
Python
1
star
39

ev-sound-analysis

Analyzing audio from electric vehicles to determine FMVSS 141 compliance
Python
1
star
40

personal-website

Personal website built with Angular 7 and Bootstrap 4
HTML
1
star
41

LoudnessHistory

An analysis of the perceived loudness of music over time.
Python
1
star