RuntimeError: .. torchaudio sox_effects .. requires sox

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\”, line 143, in wrapped
raise RuntimeError(f"{func.module}.{} 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(
            ["lowpass", "4000"],
            ["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.

评论操作 固定链接


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.