NativeInstruments / ni-media

NI Media is a C++ library for reading and writing audio streams.
MIT License
235 stars 34 forks source link

Supported File Formats #6

Closed wolfv closed 6 years ago

wolfv commented 6 years ago

I just used libsndfile for a library, but this looks like a great contender.

Is there documentation on what formats are supported? I could find wav and aiff subfolders, and now I am guessing those are the supported file formats?

marcrambo commented 6 years ago

Hi,

here is the (somewhat hidden) documentation about supported file formats: https://github.com/NativeInstruments/ni-media/blob/master/audiostream/doc/ifstream.md

So, on linux we support aiff, wac, flac and ogg-vorbis. On win and mac osx/ios we additionally support mp3 and mp4.

Please note that atm we do only support the standard aiff / wav encodings like pcm signed / unsigned integer and floating point types. We do not support more exotic encodings like ulaw / alaw which libsndfile actually supports.

wolfv commented 6 years ago

Thanks a lot for pointing me to the docs. I expected them to be in the root folder, but given that it's two projects in here, it makes sense.

Just out of curiosity, do you know what would be required to add MP3 support in Linux?

marcrambo commented 6 years ago

Unfortunately linux does not ship with a preinstalled mp3 decoder. This is mainly because of legal reasons ( patents / license fees). So, we do not have access to an mp3 decoder through a native os api like we do on macosx or windows. We would have to link against a third party mp3 decoding library. A couple of libraries exist but most are under GPL license so we cannot link against them in ni-media. I think the way it is usually done on linux in this case is to search for user installed codecs at runtime.

I haven't done much research on this topic so i might be wrong.

However since patents on mp3 expired this year my hope is that some new mp3 library with permissive license pops up in the near future ( ideally cross platform ) which we then can link directly.

wolfv commented 6 years ago

Thanks for your replies! Really informative.

I am going to stick to libsndfile for the moment, but maybe for the next version we'll switch over.