Dolby Surround(R), Stereo and Spatialization Effects

Extension name: spatial

This extension is a library for spatialization.
Author Name: Adam Hartman and Roger B. Dannenberg;
Author Email: rbd@cs.cmu.edu;

Additional File: spatial.lsp;
Additional File: autoload.lsp;
Additional File: nyquistwords.txt;

The spatial.lsp library implements various functions for stereo manipulation and spatialization. It also includes some functions for Dolby Pro-Logic panning, which encodes left, right, center, and surround channels into stereo. The stereo signal can then be played through a Dolby decoder to drive a surround speaker array. This library has a somewhat simplified encoder, so you should certainly test the output. Consider using a high-end encoder for critical work. There are a number of functions in spatial.lsp for testing. See the source code for comments about these.

stereoize(snd) [SAL]
(stereoize snd) [LISP]
Convert a mono sound, snd, to stereo. Four bands of equalization and some delay are used to create a stereo effect.

widen(snd, amt) [SAL]
(widen snd amt) [LISP]
Artificially widen the stereo field in snd, a two-channel sound. The amount of widening is amt, which varies from 0 (snd is unchanged) to 1 (maximum widening). The amt can be a SOUND or a number.

span(snd, amt) [SAL]
(span snd amt) [LISP]
Pan the virtual center channel of a stereo sound, snd, by amt, where 0 pans all the way to the left, while 1 pans all the way to the right. The amt can be a SOUND or a number.

swapchannels(snd) [SAL]
(swapchannels snd) [LISP]
Swap left and right channels in snd, a stereo sound.

prologic(l, c, r, s) [SAL]
(prologic l c r s) [LISP]
Encode four monaural SOUNDs representing the front-left, front-center, front-right, and rear channels, respectively. The return value is a stereo sound, which is a Dolby-encoded mix of the four input sounds.

pl-left(snd) [SAL]
(pl-left snd) [LISP]
Produce a Dolby-encoded (stereo) signal with snd, a SOUND, encoded as the front left channel.

pl-center(snd) [SAL]
(pl-center snd) [LISP]
Produce a Dolby-encoded (stereo) signal with snd, a SOUND, encoded as the front center channel.

pl-right(snd) [SAL]
(pl-right snd) [LISP]
Produce a Dolby-encoded (stereo) signal with snd, a SOUND, encoded as the front right channel.

pl-rear(snd) [SAL]
(pl-rear snd) [LISP]
Produce a Dolby-encoded (stereo) signal with snd, a SOUND, encoded as the rear, or surround, channel.

pl-pan2d(snd, x, y) [SAL]
(pl-pan2d snd x y) [LISP]
Comparable to Nyquist's existing pan function, pl-pan2d provides not only left-to-right panning, but front-to-back panning as well. The function accepts three parameters: snd is the (monophonic) input SOUND, x is a left-to-right position, and y is a front-to-back position. Both position parameters may be numbers or SOUNDs. An x value of 0 means left, and 1 means right. Intermediate values map linearly between these extremes. Similarly, a y value of 0 causes the sound to play entirely through the front speakers(s), while 1 causes it to play entirely through the rear. Intermediate values map linearly. Note that, although there are usually two rear speakers in Pro-Logic systems, they are both driven by the same signal. Therefore any sound that is panned totally to the rear will be played over both rear speakers. For example, it is not possible to play a sound exclusively through the rear left speaker.

pl-position(snd, x, y, config) [SAL]
(pl-position snd x y config) [LISP]
The position function builds upon speaker panning to allow more abstract placement of sounds. Like pl-pan2d, it accepts a (monaural) input sound as well as left-to-right (x) and front-to-back (y) coordinates, which may be FLONUMs or SOUNDs. A fourth parameter config specifies the distance from listeners to the speakers (in meters). Current settings assume this to be constant for all speakers, but this assumption can be changed easily (see comments in the code for more detail). There are several important differences between pl-position and pl-pan2d. First, pl-position uses a Cartesian coordinate system that allows x and y coordinates outside of the range (0, 1). This model assumes a listener position of (0,0). Each speaker has a predefined position as well. The input sound's position, relative to the listener, is given by the vector (x,y).

pl-doppler(snd, r) [SAL]
(pl-doppler snd r) [LISP]
Pitch-shift moving sounds according to the equation: fr = f0((c+vr)/c), where fr is the output frequency, f0 is the emitted (source) frequency, c is the speed of sound (assumed to be 344.31 m/s), and vr is the speed at which the emitter approaches the receiver. (vr is the first derivative of parameter r, the distance from the listener in meters.