Skip to content

torchaudio.load() with mp3 file floods the console #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maximecb opened this issue Nov 26, 2019 · 4 comments
Closed

torchaudio.load() with mp3 file floods the console #357

maximecb opened this issue Nov 26, 2019 · 4 comments
Assignees

Comments

@maximecb
Copy link

Loading mp3 files with torchaudio.load() causes a lot of output in the console, eg:

mp3: MAD lost sync
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error
mp3: recoverable MAD error

I'm on ubuntu 18.04 and using torchaudio 0.3.1. I would like to know if there is a known fix to quiet the console logging. If not, such a fix should probably be implemented.

@vincentqb
Copy link
Contributor

Can you provide steps to reproduce this, with a sample file (or say this one)?

@vincentqb vincentqb self-assigned this Nov 27, 2019
@maximecb
Copy link
Author

maximecb commented Nov 27, 2019

Not able to reproduce it with the file you provided, but I can reproduce it with this mp3:
http://www.mixotic.site/mixes/050_-_DJ_Kirill_Sergeew_-_Modern_Classiques_Vol_3/Mixotic_050_-_DJ_Kirill_Sergeew_-_Modern_Classiques_Vol_3_2006-09-25.mp3

When loading from an offset:

import torchaudio

# http://www.mixotic.site/mixes/050_-_DJ_Kirill_Sergeew_-_Modern_Classiques_Vol_3/Mixotic_050_-_DJ_Kirill_Sergeew_-_Modern_Classiques_Vol_3_2006-09-25.mp3
data = torchaudio.load('Mixotic_050_-_DJ_Kirill_Sergeew_-_Modern_Classiques_Vol_3_2006-09-25.mp3', num_frames=20000, offset=630000)

Running the script produces unwanted console output:

python3 test_load.py 
mp3: MAD lost sync
mp3: recoverable MAD error

This may not seem that bad, but if you're loading chunks of mp3 audio in a loop, it floods the console. The audio does seem to load fine though. If I save it to another output file, there are no glitches or anything.

@vincentqb
Copy link
Contributor

Something is misread with this audio file using sox. In particular, it is not being read properly in between 63000 and 64000.

import torchaudio                                                                                                      
f = "Mixotic_050_-_DJ_K
irill_Sergeew_-_Modern_Classiques_Vol_3_2006-09-25.mp3"                                                                                           

t = torchaudio.load(f)
data = torchaudio.load(f, num_frames=20000, offset=630000)                                     
# mp3: MAD lost sync
# mp3: recoverable MAD error

(t[0][:,630000:(630000+20000)] - data[0]).abs().mean()                                                                                                          
# tensor(0.0023)

t[0][:,630000:(630000+20000)]                                                                                                                                           
# tensor([[-0.0726, -0.0734, -0.0684,  ...,  0.1730,  0.1710,  0.1692],
#         [-0.0867, -0.0886, -0.0867,  ...,  0.1738,  0.1713,  0.1696]])

data[0]                                                                                                                                                                 
# tensor([[0.0000, 0.0000, 0.0000,  ..., 0.1730, 0.1710, 0.1692],
#         [0.0000, 0.0000, 0.0000,  ..., 0.1738, 0.1713, 0.1696]])

We are discussing an option to change backend, see #355.

@vincentqb vincentqb mentioned this issue Dec 4, 2019
14 tasks
@mthrok
Copy link
Collaborator

mthrok commented Nov 3, 2020

@maximecb

Do you still experience the issue? With the latest torchaudio, I cannot reproduce the issue.
I will close the issue but feel free to reopen if you are still facing the issue.

@mthrok mthrok closed this as completed Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants