125th AES Convention Coverage »  (San Francisco, CA: October 2 - 5)

Audio Programming

Audio Code Library

Some of us here at Harmony Central are working on a synthesis and audio processing program. As the development moves forward, we intend to publish some of the code on this page for your own use. We simply ask that if you use the code in any public release, you credit the author and possibly make the product available for free or publish any modified code. Please note that the code has not been completely optimized to preserve some clarity of the code.

We know that the entire structure of the program isn't explained yet, but the code should be fairly understandable. If there are some things in particular you'd like to see code for, feel free to tell us and we may be able to help you out.

Audio Programming Tools and Resources

General Purpose

Commercial Libraries

Platform Specific

Macintosh

Windows

Java

Unix

BeOS

SDKs

More Sample Code and Algorithms

DSP References

Recommended Reading

Alias-Free Digital Synthesis of Classic Analog Waveforms
By Tim Stilson and Julius Smith
(Download PDF Version (330K). Download Postscript Version (103K))
For those trying to build an analog synth, this may be useful to you. It discusses using BLITs for the alias-free digital synthesis of sawtooth, rectangle (square with variable duty cycle), and triangle waveforms, presenting the algorithms to create them from BLITs. It does discuss methods for creating the BLITs as well, with an analysis on the aliasing problems.

Analyzing the Moog VCF with Considerations for Digital Implementation
By Tim Stilson and Julius Smith
(Download PDF Version (654K). Download Postscript Version (204K))
If you're trying to recreate the analog synth sound in software, this paper discusses the issue of creating a digital version of the Moog "ladder" VCF. The anaylsis looks pretty thorough, but it is rather dense and you'll have to make some compromises. It's doesn't present a single, simple, comprehensive algorithm, so you'll have to do a of your own little work.

3D Audio and Acoustic Environment Modeling
By William Gardner
(Download PDF version)
This paper describes common 3D audio simulation technology, and also gets into reverb and virtual speaker algorithms. It doesn't contain complete equations and necessary data to implement a full system, but it should get you off to a good start. The author has done a lot of work with reverb and positional audio, include the thesis below.

Effect Design - Part 1: Reverberator and Other Filters
By Jon Dattorro, Journal of the Audio Engineering Society, Vol.45, No. 9, 1997, p. 660-684
This is part 1 of a three part article. If you have a decent signals and systems background already, this is a great reference! This part covers reverberator design (including a graphical plate reverb recipe) and various filters (cut, boost, low pass). The paper includes a pretty detailed analysis of filter topologies and noise, plus hardware issues. If you want to make high-quality filter designs, grab this article.

Effect Design - Part 2: Delay-Line Modulation and Chorus
By Jon Dattorro, Journal of the Audio Engineering Society, Vol.45, No. 10, 1997, p. 764-788
Part 2 of the series is entirely dedicated to delay based effects - chorus, flanging, and vibrato. It discusses interpolation techniques with noise and distortion analyses. It also includes and appendix on multi-rate systems (up/downsampling, interpolation/decimation, and polyphase principles.) This is great if you want to get into some grungy design details. I was told that due to legal problems between the author and a previous employer, these articles will not be available through the AES. You'll probably need to make photocopies of the journal in a library to get a copy. To my knowledge, part 3 has not been published, and may never appear.

Digital Stereo 10-Band Graphic Equalizer Using the DSP56001
Application Note APR2/D, Motorola Inc.
(Download in PDF format)
This application note describes a basic 10-band equalizer, which is essentially just a 10 bandpass filters in parallel for each audio channel. Although much of the content is specific to Motorola's hardware, the filter design steps and algorithm are clearly presented so it should be relatively straightforward to implement it on another platform.

A Digital Signal Processing Primer with Applications to Digital Audio and Computer Music
by Ken Steiglitz, published by Addison-Wesley. ISBN 0805316841
(Buy it at Amazon)
This book really is a good introduction to DSP, although some college level math may be required to understand everything. I kind of wish I had it when I was taking my first signal processing classes - I think it would have made it quite a bit more interesting! It begins with some physics basics and quickly moves into essential theory - transforms, computing frequency responses, aliasing, sampling, etc. If you're solely interested in audio DSP applications and algorithms, you won't get a whole lot from this book as it does spend most of the time on theory. Some of the particular applications covered are resonant filters, plucked string filters (to create fractional delay lengths), some high level filter design, CD player technologies, reverb, FM synthesis, and the phase vocoder. It doesn't always go into a lot of detail on these applications though and you would want to find other references (the book does list some in each chapter) to do thorough implementations. Buy it for the theory; not the applications.

Discrete-Time Modeling of Acoustic Tubes Using Fractional Delay Filters
By Vesa Välimäki.
This doctoral thesis offers a very detailed look at modeling acoustic tubes and implementing fractional delays digitally, which is an essential part of physical modeling. Without some solid filter theory, I don't think you'll make it very far with this. If you're interesting in building some physical models, this is a great reference. It doesn't offer a complete model ready to be implemented in code, but all the building blocks and filter design tools are there. It touches on excitation models (i.e. vibrating reeds) and sound radiation, but you'll need another reference for all the details on those. The bulk of the paper is on fractional delay filter design however, including variable delays which may also be useful for implementing audio effects like flanging.

Windows 95 Multimedia & OBDC API Bible
by Richard J. Simon (editor), published by Waite Group Press. ISBN 1571690115
(Buy it at Amazon)
This book is a good overall reference for the standard Windows multimedia API. It lists all functions with descriptions that I thought were better that what was included with Visual C++. It also include some snippets code which is pretty useful. The book covers the waveform audio interface, MIDI, general multimedia controls for audio and video, and file I/O. I only used the section on waveform audio, but it was very useful to me. However if you're interested in only getting access to audio input and output on a sound card, I would really suggest checking out Microsoft's DirectSound interface before shelling out the cash to buy this book. DirectSound will in generaly give you better performance, but your program may not be compatible with as many hardware combinations.

A Programmer's Guide to Sound
by Tim Kientzle, published by Addison-Wesley. ISBN 0201419726
(Buy it at Amazon)
If you need to create a program that can read and write various sound file formats and have no idea what's involved, you should definitely look at this book. It also discusses some of the audio routines in operating systems (Windows, MacOS, and Unix.) The included CD-ROM contains all the C++ source code used in the book, which handles decompressing MPEG, IMA ADPCM, and mu-Law data, reading from WAVE, VOC, AIFF, and AU file formats, and playing MIDI and MOD music files. The code will also compile into a program that can run on MacOS, Windows, and some Unix flavors. It does touch on audio processing and effects, but that is not the focus and I don't recommend you buy it for that.

Introduction to Signal Processing
by Sophocles Orfanidis, published by Prentice Hall. ISBN 0132091720
(Buy it at Amazon)
Out of all the signal processing text books I've seen, this has the largest amount of space devoted to audio applications by far. Topics covered include basic waveform generation and synthesis techniques, delays, reverb, flanging/chorus, phasing, dynamics processing, noise reduction, and equalization, on top of the usual signal processing core. Unless you have some signal processing, however, you may have a very hard time getting much out of the book. Some very basic code is provided in the book, and you can download the C Code and Matlab Code. For more details, check out the book's home page.

Digital Audio Signal Processing
by Udo Zolzer, published by John Wiley and Sons. ISBN 0471972266
(Buy it at Amazon)
About half of this book covers the mechanics and theory of digital systems - quantization, dithering, number representations, AD/DA conversion methods, and various hardware systems. The second half of the book is more interested from the programming aspect. There isn't any actual code, but plenty of theory, equations, and diagrams for lots of different algorithms. The topics covered are equalization, room simulation/reverb, dynamics processing, sample rate conversion, and data compression (which touches on MPEG1 audio.) It's pretty technical so you'll probably need a decent signal processing background.

Digital Audio Engineering
by John Strawn, ed. ISBN 0-86576-087-X
(Buy it at Amazon)
A fairly short book. Chapters include "Introduction to digital recording and reproduction" (the sampling process, hardware involved), "Limitations on the dynamic range of digitized audio", "Architectural issues in the design of the systems concepts digital synthesizer" (some pretty low level hardware design issues), "The FRMbox - a modular digital music synthesizer" (kind of case study), and "The Lucasfilm Digital Audio Facility" (a look at a large digital audio system/case study).

C Algorithms for Real-Time DSP
by Paul Embree. ISBN 0-13-337353-3
(Buy it at Amazon)
This book quickly goes through the basics of digital filters, random processes, and C coding techniques. It also takes a look at some specific hardware systems and tools. It then goes into some real-time processing algorithms and includes real C code! Included are FIR/IIR filters, sample rate conversion, fast filtering algorithms, oscillators, power spectrum estimation, speech processing, and music processing. Specific topics in the music processing category include a 7-band equalizer, pitch shifting, and very basic synthesis (sine waves or table lookup). Some adaptive filtering applications are also covered.

Examining Audio DSP Programs
By Dennis Cronin, appeared in Dr. Dobb's Journal, July 1994.
This is more of an introductory level article. The author implemented some effects algorithms (delay, flanging, phasing, and pitch shifting) on the PC and TI's DSP Starter Kit and discussed how they were done. The Source Code for the project is also availalbe (a mix of C and assembly.)

The Virtual Acoustic Room
By William Gardner
(Download Word for Mac Version (192K), Download Postscript Version (103K))
This is actually a Masters thesis about creating a virtual room environment with four speakers. It has some general background on reverb, as well as a number of different algorithms.

Email: webmaster@harmony-central.com | © 1995-2007 Harmony Central, Inc. All rights reserved.