-
Notifications
You must be signed in to change notification settings - Fork 259
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
MP3Compressor introduces audible glitches #127
Comments
Thanks for the detailed repro @iCorv! This is really odd; |
This has been fixed in v0.5.8, which should be on PyPI within the next couple of hours. (Root cause: LAME's MP3 encoding libraries are thread-safe, but its MP3 decoding interface is not.) |
Great and fast fix, just tested it in a |
I found this very old discussion on sourceforge where they describe how to use lame in a multi-threaded environment and actually state not to use the decoder in such a scenario.
***@***.***/ ***@***.***/>
As well as this statement on thread-safe in the libmp3lame hacking doc: https://github.com/gypified/libmp3lame/blob/master/HACKING#L69 <https://github.com/gypified/libmp3lame/blob/master/HACKING#L69>
Not sure how to take this upstream with LAME and pretty much out of my comfort-zone this deep in C, but suggestions are welcome :)
… On 28. Jul 2022, at 04:09, Peter Sobot ***@***.***> wrote:
I've confirmed that this seems to be a bug in LAME - not in the encoder routines, but in its mpglib interface, which keeps a static global variable that isn't thread-safe <https://github.com/lameproject/lame/blob/1f5cc9487284d5950343aa5d4f70de433468070a/libmp3lame/mpglib_interface.c#L105-L107> when decoding MP3 frames.
We'll have to change our usage of LAME's hip_decode_* functions to either be locked by a global mutex or to use a custom thread-safe interface into the underlying functions instead. (Reporting this bug upstream to LAME may also be useful if time allows.)
—
Reply to this email directly, view it on GitHub <#127 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AA67GKEXTMA6IWS2T5KV4D3VWHTXHANCNFSM542KWXVQ>.
You are receiving this because you were mentioned.
|
MP3Compressor
: Introduces audible glitches in multiprocessing environment, in particulartf.data
.Expected behavior
tf.data
pipelines!Therefore, would expect that multiple instances of MP3Compressor are ok.
Actual behavior
When calling
MP3Compressor
from atf.numpy_function()
usingtf.data
:This results in audible glitches which are also visible in the spectrum:
The issue vanishes when setting
num_parallel_calls=1
, which indicates a problem with multiprocessing. Using the GSM compression does not show a similar issue, so maybe it is connected to the Lame mp3 implementation?Steps to reproduce the behavior
Working example:
The text was updated successfully, but these errors were encountered: