This page describes various Mathematica packages useful for demonstrating concepts in computer-music theory.

Stanford Computer Music Theory Package


    The main body of Mathematica functions are contained in this package. Emphasis is on spectral transformation and display of sound signals.
minimum Mathematica version required: 2.0
Package source code: SCMTheory.m (45 KB) [23Jan97]
    Function Examples -- demonstrations of particular functions and use of options with those functions.
      SeqPlot -- a function for plotting periodic sequences. Allows for periodic extension, bandlimited interpolation; many display options.
SeqPlot.nb.gz (75 KB)
SeqPlot.pdf (82 KB)
      DFTAnalyze -- a function to plot a complex signal and its spectrum. Can plot either as real/imaginary or magnitude/phase.
DFTAnalyze.nb.gz (280 KB)
DFTAnalyze.pdf (281 KB)
      EvenOddPlot a function which will plot the even, odd, and combined forms of a function.
EvenOddPlot.nb.gz (27 KB)
EvenOddPlot.pdf (34 KB)
      EvenOddSinusoidPlot -- a specialized version of EvenOddPlot which will plot the even and odd parts of real sinusoid with arbitrary phase.
EvenOddSinusoidPlot.nb.gz (120 KB)
EvenOddSinusoidPlot.pdf (126 KB)

    Example notebooks

      Modulo Sequences -- demonstration of various sequence manipulators, including: flip, repeat, shift, stretch, decimate, interpolate, convolution, correlation and zero padding.
ModuloSequences.nb.gz (66 KB)
ModuloSequences.pdf (101 KB)
      Spectral Plots -- Plotting complex sequences in 2 and 3 dimensions.
SpectralPlots.nb.gz ()
SpectralPlots.pdf ()
      Generalized Complex Sinusoid -- Presents the four component mathematica parts of a complex sinusoid: amplitude, phase, frequency and decay.
ComplexSinusoid.nb.gz (321 KB)
ComplexSinusoid.pdf (247 KB)
      Parabolic Peak Interpolation -- Demonstrates the technique of parabolic peak interpolation to detect frequency components in spectra.
ParabolicPeak.nb.gz (39 KB)
ParabolicPeak.pdf (44 KB)
      Spectrum by Similarity -- Demonstrates the basic principle of measuring a spectrum and compares measuring spectra with real and complex sinusoids.
SpectrumSimilarity.nb.gz (884 KB)
SpectrumSimilarity.pdf (248 KB)



    Implementation of various windows described in the following paper:
    Harris, Frederic J. "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform," Proceedings of the IEEE, Vol.66, No.1 (January 1978) pp. 51-84.
    Includes continuous and discrete forms of the windows, and also functions to display the fourier transform of the windows.
minimum Mathematica version required: 3.0
Package source code: Windows.m (11 KB) [22Apr97]
Tutorial: Windows.nb.gz (272 KB)
Windows.pdf (168 KB)

Time Domain Alias Cancellation


    A small package to demonstrate an audio compression technique of converting a time signal into a critically sampled frequency signal with no increase in data rate.
minimum Mathematica version required: 2.0
Package source code: TDAC.m () []

Using sound files


    Demonstrates how to read a soundfile into Mathematica. Not extensively developed because Mathematica is slow at large numeric processing. Works only on NeXT/Sun sound files, but is designed to extend to other formats easily.
minimum Mathematica version required: 2.0
Package source code: SoundFile.m (10 KB) [18Feb97]
Tutorial: SoundFile.nb.gz (71 KB)
SoundFile.pdf (76 KB)

FM synthesis spectral plots


    This package contains functions for plotting and manipulating frequency spectra of carrier/frequency/index combinations used in simple FM synthesis. In addition, additive-synthesis spectral plots can be created and manipulated with this package.

minimum Mathematica version required: 2.0
Package source code: FMPlot.m (12 KB) [22Mar95]
Tutorial: FMPlot-tutorial.nb.gz (84 KB)
FMPlot-tutorial.pdf (96 KB)
Background on FM synthesis: aboutFM.nb.gz (152 KB)
aboutFM.pdf (78 KB)

© 1997, Craig Stuart Sapp <>, All rights reserved.