bastibe / python-soundfile

SoundFile is an audio library based on libsndfile, CFFI, and NumPy
BSD 3-Clause "New" or "Revised" License
709 stars 108 forks source link

LAME support for mp3 format? #291

Open peircej opened 3 years ago

peircej commented 3 years ago

Since mp3 patents have apparently now expired (2017) I guess there isn't a legal issue with using LAME to decode mp3 files anymore? Is it worth looking into here or just waiting for libsndfile to support mp3 natively?

bastibe commented 3 years ago

I think it would be best to integrate LAME into libsndfile first, and then add the (minor) modifications necessary to support it here.

oplatek commented 3 years ago

Hi @bastibe, FYI: https://github.com/libsndfile/libsndfile/discussions/701#discussioncomment-588058 MP3 is now supported.

bastibe commented 3 years ago

That's fantastic news! And they now provide precompiled binaries for Windows, too!

But as far as I can tell, MP3 support is not yet included in a tagged release, right? I'll update soundfile as soon as MP3 support is officially released.

In the meantime, would (any of) you be interested in contributing a pull request that adds MP3 support to soundfile?

oplatek commented 3 years ago

Hi @bastibe!

In the meantime, would (any of) you be interested in contributing a pull request that adds MP3 support to soundfile?

  1. What is the amount of work we talk about?
  2. Is there an example to be followed?
bastibe commented 3 years ago

Probably not a ton of work. Mostly adding the new _formats, _subtypes, _default_subtypes (copy from the libsndfile header), and making sure everything still works as expected. Then perhaps adding a test, and a note to the README. If all goes well, three new lines in the aforementioned variables is all the code change required to make it work.

Once it is confirmed working and libsndfile tags a new release, I can update the _soundfile_data repo with current binaries and release a new version of soundfile.

sammlapp commented 2 years ago

Any updates here? If nobody is working on this, I might take a crack at it.

bastibe commented 2 years ago

No update. We are still waiting for libsndfile to ship their MP3 support.

SBrandeis commented 2 years ago

~Hello @bastibe , @oplatek & @sammlapp ! It looks like libsndfile has released MPEG support in March 2022: https://github.com/libsndfile/libsndfile/releases/tag/1.1.0~

EDIT: Just saw there is already an open PR for this: https://github.com/bastibe/python-soundfile/pull/335 Sorry for the noisy ping 😓