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

Waiting for your kind help, thank you.

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.

1 Like

Hi~ Do you solve this problem? I have the same trouble wuwuwu

Unfortunately :frowning: , I couldn’t solve the problem on Windows, but it worked on Ubuntu