JAVA AUDIO SPATIALIZATION
This project was implemented for MAT 240C - Digital Audio
Programming, instructed by Stephen Travis Pope.
introduction
This project is a simple framework for audio spatialization in
Java. The main goal was to support spatialization of audio
using an arbitrary number of input and output channels, without being
limited to a specific platform, format, or sampling rate. In
addition to this, various math and audio utilities were implemented
towards this goal.
The source code used in the project is available here:
src.zip (20Kb)
The javadoc documentation can be viewed
here.
implementation notes
Constant power panning and inverse square sound falloff was used in
the HeadphoneSpace implementation of the AudioSpace interface.
The current implementation of JavaSound is limited to two channel
audio output, but this framework can in theory support any number of
channels.
All audio samples are converted to signed double values (range -1
to 1) to simplify manipulation by mathematical functions.
Figure 1 - Examples showing Inverse Square Sound Falloff and Constant Power Panning
A simple example of the application's output
(spatializing a constant tone) can be heard here:
tone_spin_ccw.mp3
(171Kb), as well as here:
tone_spiral_away.mp3 (172Kb)
ifs spatialization
As a test application of the framework, a graphical spatializer was
developed using iterated
function systems (IFS), a type of self-similar fractal
structure (see below for further details).

Figure 2 - Graphic IFS Spatializer
The application allows the user to graphically
manipulate an IFS, which represents a two dimensional cloud of sound particles around
the user's head. Captured audio is spatialized at random
points in the cloud, and played back in real-time. An example of
the application's output can be heard here: ifs.mp3
(84Kb)
An iterated function system can be defined as an attractor formed
by the union of a finite number of contraction mappings. This
project uses a type of contraction mapping known as an affine
transform, wherein each transform in the IFS is a scaled, translated,
sheared, and/or rotated image of the entire IFS. Since this
'self-transformation' occurs an infinite number of times, the IFS
possesses a very complex, self-similar structure.

Figure 3 - Simulated generation of IFS with three affine
transforms (scale + translation)
To generate an image of the IFS, a random-iteration
algorithm can be used. Since an IFS is an attractor, if a
point is repetitively transformed by randomly-chosen transforms in the
IFS, the point will gravitate toward only those points in the IFS.
If the
point is plotted after each random transformation, an image of the IFS'
structure will quickly coalesce.
references and links
Java Sound Resources
Tritonus
God's gift to Java
developers
Ptolemy Project
Donald M. Davis, 'The Nature and Power of Mathematics' - Princeton, 1993
Michael F. Barnsley, 'Fractals Everywhere' - Academic Press, 1993
|