Using Linux-based Tools for Musical Signal Analysis

Version 2005-01-07

Kai Lassfolk
Department of Musicology
University of Helsinki

Preface

This document describes the usage of some musical signal analysis related programs available at the Music Reseach Laboratory, University of Helsinki. The documentation assumes that the programs are already installed on the computer and the required default definitions and user privileges have been set.

For installation and setup information, please refer to the documentation of the individual programs (if available). Please note that some of the programs discussed here have been modified to make them work on our Linux system.

Introduction

This document concentrates on the usage of signal analysis tools providing a graphical representation of audio signals.

Extracting sound files from an audio CD

The cdda2wav-command allows to extract sound files from an audio CD. The usage is as follows:

    cdda2wav -t <track number> <sound file>.wav
For example, the command
    cdda2wav -t 4 test.wav
extracts track 4 from the CD and stores it in the file test.wav.

The option -m can be used produce a mono sound file instead of stereo:

    cdda2wav -m -t 4 test.wav

On some systems, the CDROM device has to be defined explicitly, for example in the following manner:

    cdda2wav -D /dev/cdrom -t <track number> <sound file>.wav

cdda2wav produces two additional files named (in this case) "test.cddb" and "test.inf". They are not needed for the analysis and can be destroyed. For more information on cdda2wav, refer to its man page (command "man cdda2wav").

Notes

Sono

Sono is a program that can print sonogram plots of recordings with durations of several minutes (or even hours). This makes sono suitable for the analysis of entire musical performances. Sono analyses a sound file (our version uses WAV files, some versions require AIFF files) and produces a PostScript file containing the sonogram plot as a result.

Sono contains a simple graphical user interface to select the input sound file and to enter the name of the resulting PostScript file. The program alse allows to start the GhostView program interactively to view the sonogram. The resulting PostScript file contains a cover page (with user-definable information) and other pages each containing sonogram plot of a minute of the sound.

Sono has very limited capabilities to adjust the analysis parameters. Therefore, it is usually required to modify the sound file before it is analyzed with Sono. For example, to limit the frequency range (to exclude high frequencies that are usually invisible in sonogram plots of musical signals), sampling rate conversion can be performed on the sound file using a suitable tools, such as sox (see below).

Sono is started by typing the command "sono" at a Linux terminal (xterm or equivalent). All adjustments are made interactively within sono. They should be fairly easy to figure out and thus are not discussed here.

If, for example, the sonogram analysis is stored to a file named test-sono.ps, it can be later viewed with the Ghostview graphics program by typping the command

    gv test-sono.ps
Ghostview can also print the document.

Sox

Sox is a sound file conversion tool. It can convert between several sound file formats and process audio signals by filtering, sample rate conversion etc.

To limit the high frequency range of a CD-quality sound file by sample rate conversion type, for example:

    sox test.wav -r 16000 test-16k.wav
This lowers the CD 44.1kHz sampling rate to 16kHz. As a result the sonogram plots are restrected to the frequency range of 0Hz to 8kHz.

Sox may also be used to convert wav files to the NeXT sound file format and stereo files to mono. For example, to convert a stereo wav file to snd (NeXT/SUN) format, type:

    sox test.wav -c 1 -t au test.snd
If the wav file is already monophonic, you may omit the "-c 1" part.

For more information, refer to the sox man page.

Pitchtrack

Pitchtrack is a command line program that can plot an estimate of the pitch of a monophonic melody. Here is an example of a Pitchtrack analysis:
    pitchtrack -p test.wav test-pitch.ps
This produces a PostScript file test-pitch.ps containing one or more pages of the pitch analysis.

Pitchtrack has no manual, but it prints a short usage message, if you type

    pitchtrack
with no arguments.

Snd

Snd is an interactive graphical sound file editor. It has several spectrum analysis tools, e.g. sonogram plots, 3-dimesional spectrograms, Wavelet analyses. Snd accepts several different sound file formats. Snd includes online documentation.

To manipulate the file test.wav with Snd, type the command

    snd test.wav

Notes