AIFF_DSP: An AIFF File DSP Programmer's Framework in Portable C

Date: Sat, 4 Feb 1995 11:36:46 -0500

AIFF_DSP: An Audio IFF File DSP Programmer's Framework in Portable C
available via ftp at "" in pub/dsp

Note for users of previous versions of AIFF_DSP: The only change in this
version is that unlike v21, it includes the correct version of interface.c,
which was correct in v20 but not in v21. This old version of interface.c
did not compiler under newer versions of Think C.

This archive contains code which provides a framework in which user-written
C functions which process the data in Audio IFF (AIFF) files are called.
The framework contains main() and deals with all aspects of AIFF file
handling, allowing the user to concentrate solely on the development of
his/her DSP algorithm. For those readers who are familiar with Tom Erbe's
"SoundHack" program for the Macintosh, this framework is similar to that
program except for the fact that source is available and portable and you
can add your own processing functions in a very modular, simple way.

Theory of Operation
The framework calls three user-written functions in the course of its
execution. First it calls a user-written initialization function, which
would typically do things like set up lookup tables. Then it repeatedly
calls a user-written processing function, each time placing a new block of
data in the buffer. When the AIFF file has been exhausted of data, it
calls a user-written termination function, which would typically do things
like free memory which had been malloc()'ed for a lookup table.

Though the framework was originally designed for the processing of AIFF
files where an AIFF file is taken as input and an AIFF file is made as
output, through the setting of user-defined variables, the framework can be
made to take no input or make no output. The mode in which no input is
taken is useful for tasks such as the generation of AIFF files by
algorithmic means. The "no output" mode is mode is useful for tasks such
as the analysis of AIFF files, where the analysis output goes to the screen
or to a non-AIFF file.

The three user functions and the the two user variables above are typically
defined in their own .c file. This file contains a global structure which
contains the two variables and pointers to the three functions. This
quintuplet defines what I call a "plugin." The only contact with framework
code that needs to occur is to "register" a plugin. This consists of
adding the name of the plugin to lists of other plugins in
"plugin_specific.c". All of these plugins are available at runtime and one
is chosen by the end user.

Much more could be written about how to use the framework but time
constraints compel me to merely direct the reader to the included examples
of processing functions and to the source code for the framework itself.

When THINK_C is defined (which happens automatically when that compiler is
being used), the program compiles to an executable that does some
Macintosh-specific things. Otherwise, a generic text-mode program is
created. This generic mode has been tested successfully on the following
UNIX systems, using gcc except where noted:

OS: SunOS 5.3 (UNIX System V Release 4.0) machine type: sun4d sparc
OS: HP-UX A.09.03 machine type: HP 9000/712
OS: ULTRIX 4.3 machine type: RISC (DECstation 5000/240)
OS: NeXTStep machine type: NeXT
OS: OSF/1 v2.0 machine type: Alpha (using native DEC cc)

On little-endian machines, audio data with a 16 bit sample word size is
automatically byte-swapped before delivery to the user-written processing
function. It is byte-swapped back again before being written to the output

On Macintosh compilers other than Think C, there may be some small
modifications needed to the code in "Think_C.c" that sets the file type to
'AIFF'. Other than that, if you just #define THINK_C, code should work
fine on other Macintosh compilers. The code has been tested successfully
on Think C 5.0 and Symantec C++ 7.0.

If you would like to receive email notification of further updates to these
programs, please send mail to my address below. I am also very interested
in hearing what you plan to do or have done with my code, so please drop me
a note for that reason as well.

This project was funded in part by the Ford Foundation's project to provide
grants for undergraduate research at Harvard University.

Ben Denckla
February 4, 1995

Path: /www/exparrot/

File aiff-dsp-framework-21-c.hqx35.86 KB
File Type: