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
- Clear, Efficient Audio Signal Processing in ANSI C
A guide to good programming practices, though somewhat specific to the MIPS processor.
- Sonic
A programming language designed specifically for digital audio programming, that is translated into C++ code. The translator source is provided and should be quite portable.
- Portable Real-Time Audio I/O Library
An effort to create a cross-platform library for audio programming.
- libsndfile
A library with source code for reading and writing some common audio file formats, tested on Linux, Sparc Solaris, Win32 and MacOS, and should work on others too.
- Audio File Library
Cross platform programming library for reading and writing various audio file formats.
- Secret Rabbit Code/libsamplerate
Multi-platform sample rate conversion code.
- ClearScale
An open source time stretching/pitch shifting project.
- MIDI-Perl
A collection of Perl modules for reading, writing, and manipulating MIDI files.
- Audio File Format FAQ
- Wotsit's Format
File format details on a wide variety of audio/music files.
- Ring This... Wave File Format
Basic, but not complete, details on the .wav file format for programmers.
- The Canonical WAVE File Format
More .wav file format details.
- Waveform Audio File Format (WAVE)
A plain text excerpt from the Multimedia Programming Interface and Data Specification v1.0 that gets into pretty good detail. An HTML version of the entire document is also available.
- Audio Interchange File Format 1.3
A Word document from Apple Computer that describes the AIFF file format.
- Aiff-C Information
Some details on the file format useful to programmers.
Commercial Libraries
- Comparisonics
Sells a software library to aid in finding occurrences of specific sounds in audio files.
- DiamondWare
Sound Tool Kit libraries for Windows and DOS to simplify playing/recording sounds and generating MIDI data.
- Human Machine Interfaces
Sound Operating System, an API and library for creating Windows audio programs without knowledge of the low level APIs.
- Muscle Fish
Makes a C library for finding similar sounds in audio files (audio content-based retrieval). Also make sound asset management software.
- Sinectonalysis
Signal processing libraries for TI DSPs.
Platform Specific
Macintosh
- Real Time Sound Servers
A free C++ framework for real-time audio synthesis, recording, processing, and playback on the Macintosh.
- Sound Secrets
An article the covers MacOS audio programming using the Sound Manager.
- LIBMOTO
A free library for improving performance of some common C functions.
Windows
Java
Unix
- Planet CCRMA
Not a library, but a series of packages for Red Hat linux to add optimizations for audio work as well as software.
- Programmer's Guide to OSS
The Open Sound System, a standard on several Unix platforms including Linux, Solaris, FreeBSD, and more.
BeOS
SDKs
More Sample Code and Algorithms
- Effects Explained
These articles provide a high level overview on some effects algorithms.
- BTE Audio
Articles, Reference Hardware Designs and Software Utilities for the Audio Enthusiast.
- Synthesis Techniques
A similar series, but focused on synthesis methods.
- Music-DSP Source Code Archive
Code snippets from members of the Music-DSP mailing list.
- Audio EQ Cookbook
Equations for creating different equalization filters.
- The Equivalence of Various Methods of Computing Biquad Coefficients for Audio Parametric Equalizers (195K)
A PDF file that takes a pretty technical look different methods of computing coefficients in parametic EQs.
- Digital Audio Programming
Some descriptions of audio algorithms and code samples (mostly Visual Basic).
- TSP Lab Software
Audio file and signal processing C code, as well as some filter design programs.
- compressor.zip (84K)
A compression program using C++ that processes .wav files. Should compile on FreeBSD and NT fine, and others with adjustments. See the usage notes for more information.
- Implementing Reverb Algorithms with Matlab
A paper plus matlab files and MP3 examples.
- COST DAFX
Contains a variety of effects and utilities for Matlab.
- audio.zip (17K)
This is a package of code that accompanied an article in the July 1994 issue of Dr. Dobbs Journal about effects like flanging, chorus, and pitch shifting. It contains C code for use with the Windows Sound System and assembly code for the TI DSP Starter Kit (DSK) module, written by Dennis Cronin. (This file and other files for the journal are available at ftp.mv.com in /pub/ddj)
- Interactive Digital Filter Design
An interactive page for generating digital filters with C code.
- Audio Effects Algorithms
Discusses some basic effects implementation in C-style code.
- DSP Design Performance
A series of Java-based filter design tools as well as some sample code and tutorials.
- SimulAnalog
Research project dedicated to digitally simulating analog gear.
- ADSP-2181 Experiments
Contains a filter and audio processing programs for the Analog Devices EZ-KIT Lite boards with the ADSP-2181.
- Kari's SHARC Page
Some sample code for use with the SHARC EZ-Kit Lite.
- Digital Audio Experiments
Some sample code and basic algorithms, including reading and writing .wav files under Windows.
- Audio File Format FAQ
- Aiff-C Information
Some details on the file format useful to programmers.
- CCRMA's FTP Server
contains some waveguide and physical modeling synthesis code and tutorials.
- The source code for Csound
covers a variety of different algorithms, and people have written a number of effects and synthesis instruments in high level code. The source is written in C, but the documentation is pretty sparse.
- TMS 320C50 Delay Programs
Several different delay effects as implemented on TMS 320C50 processor.
- Steven Sprenger's Time/Pitch Scaling FAQ
An overview of some of the techniques used in these effects.
- Resonant Low Pass Filter Code
Written in C.
- Discrete Fast Fourier Transforms
Some source code and a tutorial on the FFT.
- FFTW Home Page
FFT source code in C, and links to other implementations.
- FFT Code and Related Stuff
- PowerBasic FFT Code
- Hermite Curve Interpolation
DSP References
- Julius Smith's Home Page
Loads of good audio DSP information with a strong emphasis on physical modeling/waveguides.
- Mathtools.net
A scientific/engineering link directory, including DSP and audio processing.
- SPLAT (Signal Processing Links Arranged Taxonomically)
A general listing of DSP links including software tools, sound code, and hardware.
- BAI Engineering Directory
A link directory that includes audio engineering.
- Olli Niemitalo's DSP Page
Offers an audio DSP tutorial, overviews of polynomial interpolators, frequency shifting, and more.
- dspGuru
A site for DSP techniques and resources.
- DSP Dimension
Tutorials on some advanced audio applications.
- music-dsp
A mailing list dedicated to music and sound related DSP techniques and implementation.
- Digital IIR Filters in the Z-Domain
A brief tutorial that looks at a common second order resonant filter.
- DSP Design Performance
A series of Java-based filter design tools as well as some sample code and tutorials.
- Implementing IIR/FIR Filters with Motorola's DSP56000/SPS/DSP56001 Digital Signal Processors
Besides some actual assembly code, this app note discusses lowpass, highpass, bandpass, and bandstop filters (both analog and IIR digital) with equations for computing coefficients. Also includes some FIR design.
- Fast Fourier Transforms on Motorola's Digital Signal Processors
Even if you're not trying to implement the FFT on a Motorola DSP, this application note does have a decent theoretical explanation of the Fourier transform, DFT, DTFT, windowing effects, and of course the high-level FFT algorithm.
- A Real-Time High-Quality Time Scale Modification Method of Acoustic Signals
A paper on a new processing technique with sound examples.
- RATECONV
Some information and theory of a sampler rate conversion program, although the source may not be available on the site.
- DSP Related
A listing of DSP resources,
- Audio Programming Mailing List
- Octave
A free software package rather similar to Matlab, including routines for reading/writing audio files, recording, and playing sounds, as well as signal processing routines. Available for several platforms.
- SPARTA
Makers of SignalScape, a signal processing environment.
- Room Acoustics Modelling
Some of the theory and algorithms behind room simulation and reverb.
- Clear, Efficient Audio Signal Processing in ANSI C
Tips for writing fast code for audio applications, with extra details on MIPS processors.
- JMac's DSP Notes
Some implementation issues (including some C code) for common topics like windowing, determining frequency responses, filers, etc.
- The NextMusic Home Page
A mailing list about DSP and music programming in NeXTSTEP/OpenStep.
- .electronica
A mailing list devoted to synthesis methods and audio processing gear.
- Audio Effects FAQ v1.0
This FAQ is aimed at the programmer and covers some of the simple DSP techniques.
- Tomi Engdahl's Electronics Info Page
Links for sites related to audio, music, MIDI electronics, and DSP references.
- Signal Processing Page
Contains a hypertext version of the comp.dsp FAQ, issues of the SigProc Newsletter, info on software, and more.
- DSP and Embedded Systems Tools
- DSP-World.com
A Spanish-only site with some information on common DSP chips for audio.
- Texas Instruments
Documentation and sample code for their DSPs.
- Motorola AltiVec Technology
Info on the vector parallel processing extensions to the PowerPC.
- comp.DSP FAQ
or an HTML version.
- Signal Processing Information Base
Software, bibliographies, and papers.
- comp.dsp
newsgroup.
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.