msndfile is a Matlab Mex file that uses the C library libsndfile ( to read audio files.
Matlab C Roff Python Shell Batchfile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

The msndfile Mex extension

Marc Joliet

For more information, visit the project homepage.


msndfile is a suite of MATLAB Mex wrappers of the libsndfile C library for reading and writing audio files. Currently, it consists of of two functions: and msndfile.blockread. The former is intended as an API compatible replacement for wavread(), latter is intended for reading audio files block-wise, for instance to process large files that don't fit in RAM.

Due to the use of libsndfile, msndfile supports more formats than wavread, such as various WAV version not supported by wavread (e.g., ADPCM, µ-law and A-law), OGG Vorbis and (in my opinion much more interesting) the Free Lossless Audio Codec FLAC.

Still missing are the corresponding functions for writing data: msndfile.write and msndfile.blockwrite. Just as with, msndfile.write is supposed to be API-compatible with wavwrite.

Installation from source

There are two ways to compile msndfile. The easy way, in Matlab, is to type compile_msndfile to compile all Mex extensions. The resulting package directory +msndfile should be copied to a location in MATLABs path.

There is also a more flexible build system based on SCons that can also generate a Visual Studio IDE project file and can be integrated into other IDEs like Eclipse. This build system is explained in more detail in the full documentation on the project homepage (or in the doc directory in the source repository).


msndfile is Copyright (C) 2010-2015 Marc Joliet and licenced under the MIT licence. See the file LICENSE in the project repository.

The documentation of msndfile (including this README) is Copyright (C) 2010-2015 Marc Joliet and licenced under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The SCons logo is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported license.

The Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported license.

The test files test.{raw,flac,wav} are an excerpt of "Glass Cafe" by Jon7 and are licensed under the Attribution-NonCommercial-ShareAlike 2.5 Generic (CC BY-NC-SA 2.5) license.

libsndfile is maintained by Erik de Castro Lopo and is licensed under the LGPLv2.1 (included in the source directory, see the file LGPL-2.1.