Libsndfile is a C library for reading and writing files containing sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format) through one standard library interface. It is released in source code format under the Gnu Lesser General Public License.

The library was written to compile and run on a Linux system but should compile and run on just about any Unix (including MacOS X). There are also pre-compiled binaries available for 32 and 64 bit windows.

It was designed to handle both little-endian (such as WAV) and big-endian (such as AIFF) data, and to compile and run correctly on little-endian (such as Intel and DEC/Compaq Alpha) processor systems as well as big-endian processor systems such as Motorola 68k, Power PC, MIPS and Sparc. Hopefully the design of the library will also make it easy to extend for reading and writing new sound file formats.

It has been compiled and tested (at one time or another) on the following systems:

At the moment, each new release is being tested on i386 Linux, x86_64 Linux, PowerPC Linux, Win32 and Win64.

Features

libsndfile has the following main features :

libsndfile has a comprehensive test suite so that each release is as bug free as possible. When new bugs are found, new tests are added to the test suite to ensure that these bugs don’t creep back into the code. When new features are added, tests are added to the test suite to make sure that these features continue to work correctly even when they are old features.

History

My first attempt at reading and writing WAV files was in 1990 or so under Windows 3.1. I started using Linux in early 1995 and contributed some code to the wavplay program. That contributed code would eventually mutate into this library. As one of my interests is Digital Signal Processing (DSP) I decided that as well as reading data from an audio file in the native format (typically 16 bit short integers) it would also be useful to be able to have the library do the conversion to floating point numbers for DSP applications. It then dawned on me that whatever file format (anything from 8 bit unsigned chars, to 32 bit floating point numbers) the library should be able to convert the data to whatever format the library user wishes to use it in. For example, in a sound playback program, the library caller typically wants the sound data in 16 bit short integers to dump into a sound card even though the data in the file may be 32 bit floating point numbers (ie Microsoft’s WAVE_FORMAT_IEEE_FLOAT format). Another example would be someone doing speech recognition research who has recorded some speech as a 16 bit WAV file but wants to process it as double precision floating point numbers.

Here is the release history for libsndfile:

Licensing

libsndfile is released under the terms of the GNU Lesser General Public License, of which there are two versions; version 2.1 and version 3. To maximise the compatibility of libsndfile, the user may choose to use libsndfile under either of the above two licenses. You can also read a simple explanation of the ideas behind the GPL and the LGPL here.

You can use libsndfile with Free Software, Open Source, proprietary, shareware or other closed source applications as long as libsndfile is used as a dynamically loaded library and you abide by a small number of other conditions (read the LGPL for more info). With applications released under the GNU GPL you can also use libsndfile statically linked to your application.

I would like to see libsndfile used as widely as possible but I would prefer it if you released software that uses libsndfile as Free Software or Open Source. However, if you put in a great deal of effort building a significant application which simply uses libsndfile for file I/O, then I have no problem with you releasing that as closed source and charging as much money as you want for it as long as you abide by the license.

Download

Check latest version on GitHub Releases page.

Binaries and source packages are signed by current releaser David Seifert aka @SoapGentoo. You can verify signatures with his public GPG key:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mQINBFppABgBEAC42ZiNvV7BTIgR6TQy0YnF54fx3mVRP1u8Mq00UZa7reAsNKh7
1H60j0W4s6+4pVVIKGfpVGxLwUdJe+KVCYw1Cd3YW6uMf5zZrC/ZWqnJiH/n6S6o
1l4INII2o6YbGBnzIWBPRo7PlOL+mvgKTLpBSJPnhD8XDGN5wRiV8rL2+6Dptg0F
nJt7oxECGF3OD3gk6HMel0o82CVkIqMtNaX1L/bhcdF7K0Rp2MXPZMmpn1izW5sI
asN1G9+w+Zwj7kMJzq1Aw3ac+rsX4SEYdvXjS2QhDHQUIr6LXri3D2WbcEqIZj2R
JVoVwblsrG11dYXFDBbgrq4NhgTBsxHYDlkr/qF2W+kbPC/nhSqTVZeCYvTBZbOQ
+RqyN/I0izukglnWmV1jGijFA8snyP8efx732hw/24zRYmtXOtnEITUpw8WOeZCq
6uiHaQ+eopnY2ojBg9BI7WZm0AFn58xxT9soMsyFOUFgXTqaWFZWlJ3fhZE8/0v8
JEu/kPGE5aJReT3b34B+Bojkj74XR+h2u7iJJBHMTE8RwGoUOZHer/XsL9xlcdks
I+7TCjiq++ShaSSt2XsJmw2BhREohrjW/2KkwmvT3b44RMpKPB4WTH+++aqJQNeM
IqmswOMoZvzEZezInj7WVY/r0WEei1Y6wt1tBrJ/cFf1oQBM1UmphxcrfQARAQAB
tB9EYXZpZCBTZWlmZXJ0IDxzb2FwQGdlbnRvby5vcmc+iQJUBBMBCgA+BQs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