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.

"speed" effect does not work

See original GitHub issue

To reproduce:

filename = "test.wav"

effect = torchaudio.sox_effects.SoxEffectsChain()
effect.set_input_file(filename)
effect.append_effect_to_chain("speed", 1.0)
x,sr = effect.sox_build_flow_effects()
x.shape

effect = torchaudio.sox_effects.SoxEffectsChain()
effect.set_input_file(filename)
effect.append_effect_to_chain("speed", 2.0)
x,sr = effect.sox_build_flow_effects()
x.shape

x.shape will be the same for both.

The “tempo” effect does work, though. Weird, because these two effects have the same interface in SoX.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mthrokcommented, Nov 3, 2020

The SoxEffectChain implementation is removed from torchaudio in #977 and the replacement implementation can handle this in the similar manner. (you still need to add "rate", but it is documented clearly https://pytorch.org/audio/0.7/sox_effects.html#applying-effects-on-tensor

import torchaudio

data, sr = torchaudio.sox_effects.apply_effects_file('test/torchaudio_unittest/assets/sinewave.wav', [['speed', '1.0'], ['rate', '16000']])
print(data.shape, sr)


data, sr = torchaudio.sox_effects.apply_effects_file('test/torchaudio_unittest/assets/sinewave.wav', [['speed', '2.0'], ['rate', '16000']])
print(data.shape, sr)
torch.Size([1, 64000]) 16000
torch.Size([1, 32000]) 16000

I am closing this issue, but @lorenlugosch if you are still experiencing the error with the latest torchaudio, let us know.

1reaction
engineerchuancommented, Sep 17, 2019

Hi Loren,

Can you try adding “rate” as well at the very end?

filename = "test.wav"
si, _ = torchaudio.info(filename )

effect = torchaudio.sox_effects.SoxEffectsChain()
effect.set_input_file(filename)
effect.append_effect_to_chain("speed", 1.0)
effect.append_effect_to_chain("rate", si.rate)
x,sr = effect.sox_build_flow_effects()
x.shape

effect = torchaudio.sox_effects.SoxEffectsChain()
effect.set_input_file(filename)
effect.append_effect_to_chain("speed", 2.0)
effect.append_effect_to_chain("rate", si.rate)
x,sr = effect.sox_build_flow_effects()
x.shape

I believe sox command line as a convenience layer that automatically adds the rate, but this is not in the C interface. This should be a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Speed effect not working — FXhome Community
Speed effect not working ... Hi, my name is Daniel, and just yesterday, I started using Hitfilm 2 express. I've always wanted to...
Read more >
Slowness and speed effect don't affect movement in water - Jira
While having the slowness or speed by using /effect give or drinking a potion, will slow your movement or make your movement faster,...
Read more >
How to Fix Warp Stabilizer and Speed Can't be Used on Same ...
... want to speed up or decrease the speed of a clip and want to use a warp stabilizer to stabilize your clip...
Read more >
Timewarp effect does not apply - Avid Community
I tried to hold the alt key while dragging the timewarp effect onto it but nothing happens. Also there is a green dot...
Read more >
Motion Effects - Speed — Kdenlive Manual 22.12 documentation
It has been reported that the Speed effect does not work very well on H.264-formatted source video. It is recommended to transcode your...
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