RuntimeError: .. torchaudio sox_effects .. requires sox
Hi,
I’m trying to filtering and sample rate changing for Data Augmentation. Similar to the example in the link below :
“Audio Data Augmentation — PyTorch Tutorials 1.12.1+cu102 documentation”
But I am getting the following error message:
File “C:.…\lib\site-packages\torchaudio_internal\module_utils.py”, line 143, in wrapped
raise RuntimeError(f"{func.module}.{func.name} requires sox")
RuntimeError: torchaudio.sox_effects.sox_effects.apply_effects_tensor requires sox
-My env: Python 3.7.8, PyCharm, win10.
-I have installed win sox. And i have added sox folder to my PATH from Environment Variables
I am sharing a sample code snippet below.
def codec_apply(waveform):
# Apply filtering and change sample rate
filtered, sample_rate2 = torchaudio.sox_effects.apply_effects_tensor(
waveform,
sample_rate,
effects=[
["lowpass", "4000"],
[
"compand",
"0.02,0.05",
"-60,-60,-30,-10,-20,-8,-5,-8,-2,-8",
"-8",
"-7",
"0.05",
],
["rate", "8000"],
],
)
codec_applied = F.apply_codec(filtered, sample_rate2, format="gsm")
return codec_applied
Is there a setting I need to make in the PyCharm? Waiting for your kind help, thank you.
Please sign in to leave a comment.
Hi,
First, please make sure the code is working when you run it from the command line. This would indicate the code is correct and the issue is with the IDE. The next step would be to compare environment variables between the command line session and the IDE.
Thanks for your answer.
I tried run it from the command line or another IDE, but I still got the error.
I guess the incompatibility problem is related to Windows OS. I didn't have a problem in Ubuntu.