Repository: pytorch/audio

Issue #2691: torchaudio.sox_effects.apply_effects_file failed to load from `.mp3` format
Created: 2022-09-19T12:00:56Z
🐛 Describe the bug
Directly load .mp3 audio with torchaudio.sox_effects.apply_effects_file will fail:
import torchaudio

file = "clips/common_voice_id_25649986.mp3"
effects = [['speed', '0.9'], ['rate', '48000']]
torchaudio.sox_effects.apply_effects_file(file, effects)
# output:
# RuntimeError: Failed to load audio from clips/common_voice_id_25649986.mp3
But torchaudio.load could make it:
# this won't produce error.
torchaudio.sox_effects.apply_effects_tensor(
    torchaudio.load(file)[0], 48000, effects
)
Versions
Collecting environment information...
PyTorch version: 1.12.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A
OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.10.2
Libc version: glibc-2.27
Python version: 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.15.0-142-generic-x86_64-with-glibc2.27
Is CUDA available: True
CUDA runtime version: 11.3.58
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce RTX 3090
GPU 2: NVIDIA GeForce RTX 3090
GPU 3: NVIDIA GeForce RTX 3090
GPU 4: NVIDIA GeForce RTX 3090
GPU 5: NVIDIA GeForce RTX 3090
GPU 6: NVIDIA GeForce RTX 3090
GPU 7: NVIDIA GeForce RTX 3090
GPU 8: NVIDIA GeForce RTX 3090
GPU 9: NVIDIA GeForce RTX 3090
Nvidia driver version: 470.74
cuDNN version: Probably one of the following:
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] numpy==1.23.1
[pip3] torch==1.12.1
[pip3] torch-edit-distance==0.3.0
[pip3] torchaudio==0.12.1
[pip3] torchvision==0.13.1
[conda] blas                      1.0                         mkl    defaults
[conda] cudatoolkit               11.3.1               h2bc3f7f_2    defaults
[conda] mkl                       2021.4.0           h06a4308_640    defaults
[conda] mkl-service               2.4.0           py310h7f8727e_0    defaults
[conda] mkl_fft                   1.3.1           py310hd6ae3a3_0    defaults
[conda] mkl_random                1.2.2           py310h00e6091_0    defaults
[conda] numpy                     1.23.0                   pypi_0    pypi
[conda] numpy-base                1.23.1          py310hcba007f_0    defaults
[conda] pytorch                   1.12.1          py3.10_cuda11.3_cudnn8.3.2_0    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torch-edit-distance       0.3.0                     dev_0    
[conda] torchaudio                0.12.1              py310_cu113    pytorch
[conda] torchvision               0.13.1              py310_cu113    pytorch

Duplicate issue #2760: torchaudio.sox_effects.apply_effects_file broken in 0.12.1
Created: 2022-10-12T13:30:42Z
🐛 Describe the bug
I have previously used this function to load audio and apply temporal effects, but upon upgrading to torch 1.12.1 and torchaudio 0.12.1 it no longer works. I stepped through in the debugger and ret = torch.ops.torchaudio.sox_effects_apply_effects_file(path, effects, normalize, channels_first, format) returns None. I am 100% sure the path is correct as torchaudio.load(path) correctly returns a tensor.
There may be a wider issue as I found a similar comment from Dr. Scott Hawley at the bottom of #2363 (this issue is unrelated to the current bug), but this also could just be the result of a colab specific quirk. Thank you.
2022-10-12 09:23:52.913 Uncaught app exception
Traceback (most recent call last):
  File "/home/rob/.cache/pypoetry/virtualenvs/traindata-xtjSOPgv-py3.8/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
    exec(code, module.__dict__)
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/streamlit_models.py", line 268, in <module>
    main()
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/streamlit_models.py", line 260, in main
    _model_detail_view()
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/streamlit_models.py", line 79, in _model_detail_view
    audio_paginator(display_audio_file, afs, items_per_page=5)
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/paginator.py", line 69, in audio_paginator
    func(i, item)
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/streamlit_models.py", line 129, in display_audio_file
    play_audio(full_path, speed="1.0", format="mp3")
  File "/home/rob/code/traindata/traindata/speechdata/streamlit/play_audio.py", line 13, in play_audio
    aud, sr = torchaudio.sox_effects.apply_effects_file(filename, effects=effects)
  File "/home/rob/.cache/pypoetry/virtualenvs/traindata-xtjSOPgv-py3.8/lib/python3.8/site-packages/torchaudio/sox_effects/sox_effects.py", line 283, in apply_effects_file
    if ret is not None:
RuntimeError: Failed to load audio from /home/rob/code/data/voxforge/audios/nestea247-b0227.mp3

Versions
PyTorch version: 1.12.1+cu116
OS: Ubuntu 20.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31
Python version: 3.8.10 (default, Jun 22 2022, 20:18:18)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-48-generic-x86_64-with-glibc2.29
[pip3] torch==1.12.1+cu116
[pip3] torchaudio==0.12.1+cu116

Closing comment (2022-10-17T17:16:10Z): Oops, looks like this is a duplicate of #2691 which remains open