Hi Encodec Team,
I am here to propose an issue with my solution.
Bug Description
The encodec command-line tool fails when trying to load audio files due to a type compatibility issue between pathlib.Path objects and torchaudio.load().
Error Message:
RuntimeError: torchaudio_sox::load_audio_file() Expected a value of type 'str' for argument '0' but instead found type 'PosixPath'.
Steps to Reproduce
- Install encodec:
pip install encodec
- Run:
encodec -b 6.0 input.wav output.wav
- Error occurs at line 109 in
encodec/__main__.py
Expected Behavior
The command should successfully compress/decompress audio files.
Actual Behavior
The command fails with a type casting error.
Environment
- Python 3.8
- torchaudio (latest)
- encodec (latest)
Proposed Solution
Convert Path object to string before passing to torchaudio.load():
Change from:
wav, sr = torchaudio.load(args.input)
To:
wav, sr = torchaudio.load(str(args.input))
I hope this helps, and please feel free to discuss further! :)
Best,
Ziyue
Hi Encodec Team,
I am here to propose an issue with my solution.
Bug Description
The encodec command-line tool fails when trying to load audio files due to a type compatibility issue between
pathlib.Pathobjects andtorchaudio.load().Error Message:
Steps to Reproduce
pip install encodecencodec -b 6.0 input.wav output.wavencodec/__main__.pyExpected Behavior
The command should successfully compress/decompress audio files.
Actual Behavior
The command fails with a type casting error.
Environment
Proposed Solution
Convert Path object to string before passing to torchaudio.load():
Change from:
To:
I hope this helps, and please feel free to discuss further! :)
Best,
Ziyue