sndfile-tools

Sndfile-tools is a small collection of programs that use libsndfile and other libraries to do useful things. The collection currently includes the following programs:

The sndfile-tools package is released under the terms of the GNU General Public License (version 2 or version 3).

The latest version is 1.04 and it can be downloaded here: sndfile-tools-1.04.tar.bz2 ( GPG signature).

It should be trivial to compile on Linux and relatively easy to compile on other Unices (including Mac OSX). Its probably possible to compile it on windows, but why would anyone bother?



sndfile-generate-chirp

Create a sound file containing a swept sine wave (ie a chirp).

    sndfile-generate-chirp  [options] <sample rate> <length in seconds> <sound file>

    Options include:

        -from <start>    Sweep start frequency in Hz (default 200Hz).
        -to <end>        Sweep end frequency in Hz (default fs/2).
        -amp <value>     Amplitude of generated sine (default 1.0).
        <sweep type>     One of (default -log):
                             -log     logarithmic sweep
                             -quad    quadratic sweep
                             -linear  linear sweep

    The output file will contain floating point samples in the range [-1.0, 1.0].
    The output file type is determined by the file name extension which should be one
    of 'wav', 'aifc', 'aif', 'aiff', 'au', 'caf' and 'w64'.


sndfile-jackplay

Play a sound file via the JACK Audio Connect Kit daemon.

    sndfile-jackplay <filename>


sndfile-spectrogram

Generate a spectrogram as a PNG file from a given sound file.

    sndfile-spectrogram <sound file> <img width> <img height> <png name>

This program (in conjunction with sndfile-generate-chirp) is particularly useful for evaluating the quality of sample rate converters. For instance, a chirp can be generated at 96kHz, passed through the converter and a spectrogram generated for the converter output file. For example:


Example spectrogram


sndfile-mix-to-mono

Convert a multi-channel input file to a mono output file, by mixing all input channels into one.

    sndfile-mix-to-mono <input file> <output file>