Libsndfile is a C library for reading and writing files containg 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 General Public License
or GPL.
The library was written to compile and run on a Linux system but should compile
and run on just about any Unix. It now also compiles and runs on Win32 systems
using the Microsoft compiler (thanks to the efforts of Albert Faber).
As the libary was designed to handle both little-endian (such as WAV) and big-endian
(such as AIFF) data, it was also designed to compile and run correctly on little-endian
(such and Intel and DEC/Compaq Alpha) processor systems as well as big-endian processor
systems such as Motorola 68k, Power PC, MIPS and Sparc. The library was also written to
be 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)
- 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++)
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.
Capabilities
libsndfile is currently capable of reading and writing the following sound file
formats :
- Microsoft WAV uncompressed file formats (8, 16, 24 and 32 bit integer as well as 32
bit floating point) PCM formats.
- Apple/SGI uncompressed AIFF and AIFC format (8, 16, 24 and 32 bit).
- Sun/NeXT AU/SND format (big endian 16, 24 and 32 bit PCM and 8 bit u-law).
- Dec AU format (little endian 8, 16, 24 and 32 bit PCM and 8 bit u-law).
- Microsoft IMA/DVI ADPCM WAV format (16 bits per sample compressed to 4 bits per sample).
- (Read-only) Microsoft ADPCM WAV format (16 bits per sample compressed to 4 bits per sample).
In the near future I hope to add the following to the list:
- Microsoft WAV A-law and u-law formats.
- Writing Microsoft ADPCM WAV format (16 bits per sample compressed to 4 bits per sample).
- Soundfont II.
- Gravis Ultrasound patch files.
- Kurzweil K2000 sampler files.
- Ensoniq Paris audio file format (.PAF).
- MPEG Layer 3.
Other file formats may also be added on request.
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.
Download
The latest version is 0.0.12 and the source code can be downloaded
here
(~150k .tar.gz file).
The latest version of this document can be found
here.
Author :
Erik de Castro Lopo
This page has been accessed
times.