torch-audiomentations icon indicating copy to clipboard operation
torch-audiomentations copied to clipboard

Pitch shifting and time stretching in a single transform

Open iver56 opened this issue 2 years ago • 4 comments

A transform that does both in one go, so it's faster (and probably sounds better) than doing pitch shifting and time stretching separately.

iver56 avatar Oct 11 '21 07:10 iver56

What is the difference wrt just resampling ? It should be pretty much the same no ?

popcornell avatar Oct 12 '21 14:10 popcornell

When I resample, I can get two outcomes:

  • The pitch goes up and the tempo goes up
  • The pitch goes down and the tempo goes down

Here's a rough illustration with a pink line that shows all the tempo + pitch combinations that we can get by resampling:

bilde

On the other hand, doing pitch shifting and time stretching allows one to get any combination of tempo and pitch (here illustrated by the blue rectangle). For example, I can pitch down the audio while speeding up the tempo slightly

iver56 avatar Oct 18 '21 07:10 iver56

Is time stretching available in torch-audiomentations? I see only PitchShift augmentation which does not change the tempo

WhiteTeaDragon avatar Oct 17 '22 16:10 WhiteTeaDragon

No, not at the moment. I recommend using the TimeStretch in audiomentations for the time being.

There is an experimental time stretch PR in torch-audiomentations, but it is nowhere near complete - it requires some changes in the "backbone" of torch-audiomentations

iver56 avatar Oct 17 '22 16:10 iver56