-
Notifications
You must be signed in to change notification settings - Fork 378
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
Add MP3 support #258
Comments
Milestone? |
Until some actually steps forward to offer to do this and actually has some code that is worth reviewing, it doesn't make sense to have a milestone. |
I hope someone steps forward and this feature would be great. |
It also seems that https://www.mpg123.de is a decoder only. All the other supported formats have both encode and decode so that would have to be the same for MP3 especially fore the CSound use case. liblame may be the best bet. |
Agreed, Bad thing i will be buzy all the summer. |
Bad thing I'm too n00b. How hard is it? |
This is definitely more difficult than using libsndfile as a library, mainly because the libsndfile API was specifically designed to be easy to use. I would also rank this as more difficult than adding Opus support, because it requires you to hook up two libraries, one for decoding and one for encoding. |
Also interesting, from this recent statement:
|
uuuuuuIn csound at present we use a Russian library libmpadec for reading. Seems OK. Is it worth investigating? I should add that it has not been changed by the author for years but i have tweaked it, and have developer status for it. Code in csound tree and on sourceforge |
Is there a template for adding a new format or does one just edit, say, ogg.c to new code? Some time since I last tried (10 years) and things have changed. |
Closest thing to a template is |
For a wider view, i see on the decoding side there's much more: there is libmad which is very VERY stable and currently many distributions still provide it, not to mention its feature being based only on integer number calculation. This makes it very suitable for embedded systems, imho. |
Does the licence matter? GPL v LGPL ? With so many options I feel the need for guidance. The mpg123 +lame plan looks like the mainsteam way to go, but I do not claim expertise in MP3. |
GPL is no good, but LGPL, BSD, MIT would all be fine. |
mpg123 can be built to perform only fixed-point math, and with better performance than MAD according to Thomas Orgis. Also, mpg123 has assembly optimizations for several architectures and SIMD flavors. |
Didn't know this, great! |
FWIW, I've used mpg123 under LGPL in my program for MPEG-2 Audio Layer II decoding (aka MP2 audio) for a while and have validated that it decodes MP3 to my liking although we don't use it for that. So one nice thing about mpg123 is that it can decode several layers of MPEG audio and not just what is known as MP3. So assuming someone else does the work for wiring in mpg123 other than me (which is likely), it would be good to accommodate the other flavors as well. |
All the other formats supported by libsndfile support decoding and encoding. As I understand it mpg123 only does decoding, so something else will have to be used for the encoder, probably liblame. |
Hello, Erik. Indeed, mpg123 only does decoding, and I strongly support using LAME for encoding. Back in 2004 I conduced a public listening test, and LAME got the best ranking (granted, it was a long time ago, but neither of the other encoders advanced much since then) Also, another reason I thought for choosing mpg123 over MAD (besides the licensing issue): MAD was last updated in 2004. mpg123 was last updated last week and the developer, Thomas Orgis, is very approachable. |
I am happy to have a go at this (unless someone else has started, in which case let me know). |
Made a start (not working yet) over here: https://github.com/concert/libsndfile/tree/mp3. Thinking about RDWR, that might be a bit tricky with the lame/mpg123 split, any thoughts on that (otherwise I might leave that mode unimplemented in the first attempt). |
Read support PR is #322. At the moment I'm after shape review to see if I'm on the right track but hopefully it makes at least some sense :) |
Lame can use libsndfile for opening its input formats, so I'm concerned that using it as a decoder for libsndfile introduces a dependency loop. If lame were to split into liblame and the lame frontend (as I believe it is the latter that has the dependency) that would break the cycle. However given that's a big change and the last release was in 2012 I don't think that's likely. Suggestions welcome. |
I'd also like to voice my thanks for working on this. I'm created (as far as I know so far), the only cross platform audio loading and playback library for C#/.NET core and I'm using |
Hey guys, just checking in on this. How's it going? Any tricky blockers or tasks you want to off-load? Echoing the many thanks you've received on your work already. |
Basically it works. The only problems of which I am aware is that if
there is an error (sorry cannot remember which it is -- reading or
writing) the library prints a message which ideally should be captured by
libsndfile and treated like all other errors in the system.
That said it could probably do with more use for testing.
|
@jpffitch is your current progress visible somewhere? That would enable me to test, and possibly, improve. |
My code is all synced to https://github.com/arthurt/libsndfile.git
His cdeworked much better; I just did a little tstig and debugging
|
Thanks! There would also be to modify doc/{index.html,FAQ} to say that
MP3 is supported. Do we know if it supports seeking and is
sample-accurate when doing so?
M
|
Is there any plan to merge https://github.com/arthurt/libsndfile.git ? |
How's it going? |
Any progress on this? Could really use this for a personal project of mine. |
It's unlikely to be included in the master branch soon, as there are still some technical problems to be ironed out. Even when it is technically sound, it will then take some years before it appears in mainline distributions due to the infrequency of Erik's new releases and the extra years it then takes for the distributions to catch up with him. For your own project, I suggest you just install arthurt's mpeg-support or mp3-codec branch and use that. If you subsequently decide to publish your work, the best strategy woud be to include a custom copy of libsndfile in your source tree and compile against that. Alternatively, you could use one of the existing decoding libraries for MP3 files, of which libmpg123 is the only one I've found that is able to seek in MP3 files to the accuracy of one sample, in case you need that. |
Looking forward to this. Thumbs up! |
Could we consider that this issue is closed with 1.1.0 ? :) |
I guess so 😄 |
Thank you everyone! I'm very happy to be able to use this once my work gives me a moment's break |
Closed #258.
Finally! :) Lots of love to all who helped
M
|
The MP3 patents have now fully expired so libsndfile can now add support.
The best bet would be https://www.mpg123.de which is LGPL and has updates as recently as this year.
I (@erikd) don't have sufficient time and motivation to do this, but would be happy to guide someone else.
The text was updated successfully, but these errors were encountered: