question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

torch transforms inspired by sox effects

See original GitHub issue

🚀 Feature

Convert sox effects into transforms. Ideally, we provide enough building blocks to make those transforms easy to assemble.

  • allpass (with biquad)
  • band (with biquad)
  • bandpass/bandreject (with biquad)
  • bass (with biquad)
  • treble (with biquad)
  • bend
  • biquad
  • ~channels (we already decided downmix, etc, is easy to do by hand)~
  • chorus
  • compand/mcompand
  • contrast
  • dcshift
  • deemph (with biquad, related to this)
  • delay
  • dither
  • downsample/upsample (available with resample)
  • earwax
  • echo/echos
  • equalizer (with biquad, see also here)
  • fade
  • fir
  • flanger
  • gain
  • highpass/lowpass (with biquad)
  • hilbert
  • ladspa
  • loudness
  • mcompand
  • noiseprof/noisered
  • ~norm (duplicate of gain)~
  • oops (simply the difference between two channels)
  • overdrive
  • ~pad/trim (easy to do without transforms)~
  • phaser
  • pitch
  • ~rate (resample already available)~
  • ~remix (we already decided downmix, etc, is easy to do by hand)~
  • ~repeat (tensor.repeat or pad with replicate)~
  • reverb
  • ~reverse~
  • riaa (with biquad)
  • silence
  • sinc
  • spectrogram
  • ~speed (change sample rate)~
  • stretch/tempo (vocoder functional available)
  • splice
  • stat/stats (only prints information about the waveform)
  • ~swap~
  • synth
  • tremolo
  • vad (in example)
  • vol

Crossed out: can be done in a simple way with current pytorch operations, so we don’t need a dedicated transform. Feel free to point out any updates recommended to this list.

Additional context

  • Remove dependency on sox in VCTK
  • Open files in format such as mp3, etc (see here and here)
  • Comment from #110 linking keunwoochoi/torchaudio-contrib#31
  • Some transforms touch on #259
  • Performance comparison between libraries for audio loading here
  • internal doc

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
mthrokcommented, Apr 6, 2020

FYI: Regarding the speed, I did simple profiling with the following script and it tells that the most time consuming part is the iteration in lfilter

Script
import pprofile

import torch
import torchaudio
import torchaudio.functional as F


def profile_biquad():
    waveform, sr = torchaudio.load('test/assets/100Hz_44100Hz_16bit_05sec.wav', normalization=True)

    prof = pprofile.Profile()
    with prof():
        F.equalizer_biquad(waveform, sr, 3000, 1, 0.707)
    prof.print_stats()


profile_biquad()
Most time consuming parts
   720|    220501|       4.4464|   2.0165e-05| 18.97%|    for i_sample, o0 in enumerate(input_signal_windows.t()):
(call)|         1|  7.86781e-05|  7.86781e-05|  0.00%|# /scratch/moto/pytorch/torch/tensor.py:460 __iter__
(call)|    220500|      2.72458|  1.23564e-05| 11.62%|# /scratch/moto/pytorch/torch/tensor.py:474 <lambda>
   721|    220500|      2.80982|   1.2743e-05| 11.99%|        windowed_output_signal = padded_output_waveform[:, i_sample:(i_sample + n_order)]
   722|    220500|      4.92106|  2.23177e-05| 21.00%|        o0.sub_(torch.mv(windowed_output_signal, a_coeffs_flipped))
   723|    220500|      3.72974|  1.69149e-05| 15.91%|        o0.div_(a_coeffs[0])
   724|         0|            0|            0|  0.00%|
   725|    220500|      4.77714|   2.1665e-05| 20.38%|        padded_output_waveform[:, i_sample + n_order - 1] = o0
1reaction
tomassosoriocommented, Feb 21, 2020

Hey! I will try to remove the pitch dependency of sox, if is no problem @vincentqb 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

torchaudio.sox_effects - PyTorch
This function only works on CPU Tensors. This function works in the way very similar to sox command, however there are slight differences....
Read more >
health_hazards_workbook.pdf
hazardous effects of the substances that you work with; study the dangers associated with the above health hazards in construction. Chemical. ▫ Gases....
Read more >
Dropping the Democratic Facade - Freedom House
A country's democratic potential is influenced not just by its own recent ... Major transformations driven by public demands for better governance have...
Read more >
Our commitment to corporate responsibility - Biogen
better outcomes, further suggesting a positive clinical effect. Advancing Digital Health. Recent advances in the understanding of disease biology, along.
Read more >
Synthetic Fuels Based on Dimethyl Ether as a Future Non ...
Work by Willems at Ford has shown that in engine tests, not only is there zero SOx emissions associated with DME fuels (because...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found