Ambiboid is a collection of Csound score file generators and granular synthesis instruments in which spatial data generated by the Boids flocking algorithm is used to control the spatialization.



This patch can be used with the implementation of Eric Singer's Boids for Max MSP Jitter which can be downloaded here. The patch records the spatial coordinates of each agent in the flock and writes them to a number of text files. In this way, spatial trajectories and movements can be generated and recorded by the user in real-time and then later used with the scorefile generator to spatialize a granular texture.


AmbiBoid Score Generators (AmbiBoidadditive.cpp, AmbiBoidglisson.cpp &AmbiBoidgranule.cpp)

These C programs can be used to generate a Csound scorefile for three granular synthesis instruments. Pre-compiled programs are included in the zip file along with the source code (Successfully compiled with Microsoft Visual Studio 6.0).
Once the desired spatial trajectories have been performed and recorded in Max MSP, the AmbiBoid utilities can be used to generate a Csound score file. Each utility/instrument pair implements a specific form of granular synthesis with shared parameters such as overall duration, number of grain streams, global reverb, etc. The density and grain duration can be fixed or dynamically varied. Various windowing functions such as Gaussian, Hamming and Hanning windows can also be chosen.


AmbiBoid Orchestra Files

Grainlet synthesis combines granular synthesis with wavelet synthesis so that the duration of each grain is related to the frequency of the source signal within that grain. In this additive synthesis version, each grain stream corresponds to a single partial whose grain duration is related to the frequency of that partial. The user specifies the fundamental frequency and the number of grain streams/partials. The grain duration consists of a 100 cycles of the signal which results in a grain duration of 1 second for the fundamental, 31 msecs for the 32nd harmonic, 15 msecs for the 64th harmonic, etc. The source signal consists of either a sine wave or a set of harmonically related sine tones.

The AmbiBoidgranule score generator and instrument performs granulation of a monophonic sample. The grain durations can either be a single fixed value for all streams, a single dynamically varying value for all streams, or a randomly chosen duration for each stream varying between a given maximum and minimum value. The playback position within the file for each grain is randomly chosen and the playback rate of the audio sample is defined in the score file.

In Glisson Synthesis, each grain, or glisson, has an independent frequency trajectory, an ascending or descending glissando. In this implementaton, the source signal frequency can be mapped to spatial elevation in two ways. The maximum and minimum elevation angles (plus and minus 90 deg) can be linearly mapped to a specified frequency range, or alternatively mapped as octaves so that each glisson contains an octave glissando whose direction depends on the spatial movement. The usual density and grain durations controls are also available.

Each instrument uses standard Csound opcodes to generate the window function and source signal. Most of the instrument code is used to implement the spatialization algorithm. The current and previous spatial coordinates are changed into a dynamic k-rate variable which is used to spatialize each individual grain with distance effects, early reflections and global reverberation.


Distance Effects

Distance effects are modelled using Chowning's well known algorithm for simulating moving sources. In this model, the intensity of the direct sound reaching the listener falls off more sharply with distance than the reverberant sound. The loss of low intensity frequency components of a sound with increasing distance from the listener is modelled by mapping distance to the cut-off frequency of a low pass filter. The Doppler effect is implementated using Csound code developed by Christopher Dobrian. Each grain is sent to an interpolating delay line whose delay time is mapped to the distance of the source. The changing distance and delay time produces a pitch shift in the audio signal which mimics the Doppler effect.

Early reflections and global reverberation are applied to each grain using Csound code developed by Jan Jacob Hofmann for an Ambisonics spatialization instrument. Specular and diffuse reflections are generated according to the distance of the source to the listener and to the specified dimensions of the virtual space. A global reverb is implemented using an eight delay line feedback delay network reverb with a feedback matrix based upon the physical modeling scattering junction of 8 lossless waveguides of equal characteristic impedance.

Finally, all the audio signals are encoded using the Furse-Malham-Set (FMH) of encoding equations for Second Order Ambisonics. The final output can be decoded for various loudspeaker configurations such as stereo, quadraphonic, octogon or a cube, using an `in-phase' response so that each speaker will have only a single maximum given a moving virtual sound source. This decoding scheme is often preferrable for playback over a large listening area as it reduces out of phase components. However more strict decoding schemes which are preferrable for a single listener can also be readily implemented.

Download here ->




Download here ->

Audio Examples (right click to download)

Additive Grainlet synthesis decoded for a periphonic cube array

Additive Grainlet synthesis with dynamically varying density, decoded for a octogon array

As above but with a higher number of harmonics

Glisson synthesis, linear mapping of elevation to frequency, decoded for a octogon array

Glisson synthesis, octave mapping of elevation to frequency, decoded for a octogon array

Granulation of monophonic distorted guitar tone