-
Notifications
You must be signed in to change notification settings - Fork 972
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
mu-law companding #1022
mu-law companding #1022
Conversation
Thanks for doing this. It looks great but i'm curious as to the practical purpose. Given that all of this operates on IEEE 754 arithmetic, i doubt it reflects the effect of mu law in practice (e.g. audio sensing with limited resources) Suppose that i have a WAV file in PCM (~fixed-point) format, encoded with a bit depth of 16 (or 24, or 32, etc.) |
z = librosa.mu_compress(y, quantize=True)
y_compand = librosa.mu_expand(z, quantize=True) I don't think we need to go as far as to add an explicit |
One more question raised offline: should quantization be the default behavior? Or are there more compelling use cases for continuous mu compression? |
LGTM. I would prefer |
Ok, I'm onboard with quantizing by default. Final question: i put this in the audio submodule, because it seemed like the most logical place. But I could also see it living under |
I would prefer Please merge at your convenience |
Fair enough, thanks again! Should we bump this up to the 0.7.2 release then? |
Sure. I just bumped it to 0.7.2 |
whoops, forgot to set |
Reference Issue
Related to #1007 , but different.
[EDIT by @lostanlen: closes #1034]
What does this implement/fix? Explain your changes.
This PR implements mu-law compression and expansion, with and without quantization.
Any other comments?
A couple of things to consider here:
lg(1+mu)
bits, which derives from the common setting ofmu=255
and 8-bit quantization. But there's technically no reason that these things have to be tied together.dtype
inference based on the number of quantization levels? Numpy doesn't make it totally trivial to infer the minimum dtype for a given value range, but it's something we could do with a bit of work. It just seems wasteful to useint64
to hold 8-bit quantized values.