audio: libsox does not detect mp3 when extension is missing

๐Ÿ› Bug

Sox IO backend doesnโ€™t allow to load file with explicit filetype while doesnโ€™t offer auto detection.

To Reproduce

Steps to reproduce the behavior:

>>> torchaudio.set_audio_backend("sox")
>>> torchaudio.load("/path/to/extensionless/file", filetype='mp3')
(tensor([[0., 0., 0.,  ..., 0., 0., 0.]]), 16000)
>>> torchaudio.set_audio_backend("sox_io")
>>> torchaudio.load("/path/to/extensionless/file", filetype='mp3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: load() got an unexpected keyword argument 'filetype'
>>> torchaudio.load("/path/to/extensionless/file")
formats: can't determine type of file `/path/to/extensionless/file'

Expected behavior

Expected an autodetect feature or allowance to pass an explicit format argument

Environment

torch/torchaudio build from source. master of v0.7.0 affected

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17

Most upvoted comments

Thanks, confirmed the issue. I will come back with the solution.