libsndfile
Guidance last updated: 19 October 2026
libsndfile is a C library for reading and writing files containing digital audio (such as uncompressed PCM audio) through one standard library interface. It is released in source code format under the GNU Lesser General Public License (LGPL).
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
libsndfile has the following main features:
Ability to read and write a large number of file formats.
A simple, elegant and easy to use Applications Programming Interface.
Usable on Unix, Win32, MacOS and others.
On the fly format conversion, including endian-ness swapping, type conversion and bitwidth scaling.
Optional normalisation when reading floating point data from files containing integer data.
Ability to open files in read/write mode.
The ability to write the file header without closing the file (only on files open for write or read/write).
Ability to query the library about all supported formats and retrieve text strings describing each format.
See also the libsndfile list of supported formats.
Usage
After connecting to Stanage (see Establishing a SSH connection), start an interactive session:
salloc
You can load a specific version with the following command:
module load libsndfile/1.2.2-GCCcore-14.3.0
module load libsndfile/1.2.2-GCCcore-12.3.0
module load libsndfile/1.2.2-GCCcore-14.3.0
List supported formats
Within an interactive session, load libsndfile/1.2.2-GCCcore-14.3.0.
Download the upstream list_formats.c example for version 1.2.2
and save the source as list_formats.c. Compile and run it with:
gcc list_formats.c $(pkg-config --cflags --libs sndfile) -o list_formats
./list_formats
The output starts with the library version and lists the supported file formats and sample encodings, including WAV and AIFF.
Installation notes
libsndfile was installed using Easybuild, build details can be found in $EBROOTLIBSNDFILE/easybuild with a given module loaded.