Backend "sox_io" is not one of available backends: ['soundfile'] even after set up of 'soundfile' on torchaudio

1.6k views Asked by At

I am working on some speech-recognition project, but I got error when I'be tried to load an audio.

RuntimeError: Backend "sox_io" is not one of available backends: ['soundfile'].

I've imported libries load_dataset, load_metric and Audio (per some tutorial)

from datasets import load_dataset, load_metric, Audio

That looks as 'sox_io' is for Linux and 'soundfile' for Windows. I am using Windows so I've changed my settings by:

torchaudio.set_audio_backend('soundfile')

But issue is still there - what I have to do to solve problem?

The above exception was the direct cause of the following exception:

ImportError: To support decoding 'mp3' audio files, please install 'sox'.

1

There are 1 answers

0
moto On

As of 0.12, mp3 is not supported by soundfile backend in TorchAudio. So there is no native way to load mp3 on Windows.

Recently pysoundfile added support for mp3, and there is a PR to add support to TorchAudio, https://github.com/pytorch/audio/pull/2712.