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. It can also be compiled and run on Win32 systems
using the Microsoft compiler and MacOS using the Metrowerks compiler (thanks to
Ben "Jacobs"). There are directions for compiling libsndfile on these platforms
in the Win32 and MacOS directories of the source code distribution.
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 so far been compiled and tested on the following systems:
- i586-pc-linux-gnu (Redhat 5.2 glibc)
- powerpc-unknown-linux-gnu (Linux PPC)
- mips-sgi-irix5.3 (Native IRIX toolset)
- sparc-sun-solaris2.7 (gcc)
- sparc-sun-solaris2.5.1 (gcc)
- mips-sgi-irix5.3 (gcc)
- mips-sgi-irix6.3 (cc - native compiler)
- Win32 (Microsoft Visual C++)
- MacOS 8.6 (Metrowerks Codewarrior Pro4)
Capabilities
libsndfile is currently capable of reading and writing the following sound file
formats :
- Microsoft WAV 8, 16, 24 and 32 bit integer PCM.
- Microsoft 32 bit floating point PCM.
- Microsoft IMA/DVI ADPCM WAV format (16 bits per sample compressed to 4 bits per sample).
- Microsoft ADPCM WAV format (16 bits per sample compressed to 4 bits per sample).
- Microsoft 8 bit A-law an u-law formats (16 bits per sample compressed to 8 bits per sample).
- Microsoft WAV files using GSM 6.10 encoding.
- Apple/SGI AIFF and AIFC uncompressed 8, 16, 24 and 32 bit integer PCM.
- Sun/NeXT AU/SND format (big endian 8, 16, 24 and 32 bit PCM, 8 bit u-law and 8 bit A-law).
- Dec AU format (little endian 8, 16, 24 and 32 bit PCM, 8 bit u-law and 8 bit A-law).
- Headerless 8kHz 8bit u-law encoded AU/SND files.
- G721 and G723 ADPCM encoded AU/SND files.
- RAW header-less PCM files of 8 (signed and unsigned), 16, 24 and 32 bits. The 16, 24 and 32
bit files may be big or little endian byte ordering. The 8 bit samples may be signed
or unsigned values.
- Amiga uncompressed IFF / 8SVX / 16SV PCM files (8 and 16 bit).
- Ensoniq PARIS big and little endian, 16 and 24 bit PCM files (.PAF).
Some of the file formats I am also interested in adding are:
- Soundfont II.
- Gravis Ultrasound patch files.
- Kurzweil K2000 sampler files.
- MPEG Layer 3.
Other file formats may also be added on request.
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 which 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 :
- Version 0.0.8 (Feb 15 1999) First official release.
- Version 0.0.9 (Mar 14 1999) Added support for IMA ADPCM WAV files and
8 bit PCM AIFF, AU and WAV files.
- Version 0.0.12 (Jun 19 1999) Added read only support for MS ADPCM WAV files plus
a number of bug fixes and code cleanups. It now also compiles and runs on Win32 systems
using the Microsoft compiler (thanks to the efforts of Albert Faber).
- Version 0.0.15 (Jul 30 1999) Added ability to write MS ADPCM WAV files. Added WAV and AU
file A-law and u-law encoding/decoding. Added RAW headerless PCM file handling. It now
also compiles and runs on MacOS using the Metrowerks compiler (thanks to Ben "Jacobs").
- Version 0.0.16 (Jul 31 1999) Fixed minor MacOS problems.
- Version 0.0.17 (Nov 16 1999) Added Ensoniq PARIS audio file format, Amiga IFF / 8SVX / 16SV
file format and minor bug fixes.
- Version 0.0.18 (Apr 25 2000) Added read/write capabilities for GSM 6.10 encoded WAV files.
- Version 0.0.19 (May 20 2000) Minor bug fix for GSM 6.10 encoded WAV files on big endian
- Version 0.0.20 (May 30 2000) Minor bug fix for LinuxPPC. Fixes endian-ness related compile
- Version 0.0.21 (Aug 16 2000) Added handling of headerless AU/SND files. Added handling
of G721 and G723 ADPCM AU/SND files. New improved Win32 compiling and use instructions.
License change from GPL to LGPL.
- Version 0.0.22 (Oct 17 2000) Bug fix for G723 encoded AU files. References to GPL replaced
with LGPL.
Similar or Related Projects
- SoX is a program for
converting between sound file formats.
- Wavplay started out
as a minimal WAV file player under Linux and has mutated into Gnuwave a client/server
application for more general multimedia and games sound playback.
- Audiofile (libaudiofile) is
a library similar to libsndfile but with a different programming interface. The
author Michael Pruett has set out to clone (and fix some bugs) the libaudiofile
library which ships with SGI's IRIX OS. If I had known of this project earlier I
may not have started on libsndfile.
- sndlib.tar.gz is
another library written by Bill Schottstaedt of CCRMA.
Licensing
libsndfile is released under the terms of the GNU Lesser General Public License. You may
read the license
here
or read a simple explanation of the ideas behind the GPL and the LGPL
here.
Download
Here is the latest version. It is available in the following formats.
The latest version of this document can be found
here.
Author :
Erik de Castro Lopo
This page has been accessed
times.