spatial
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]widen(snd, amt) [SAL](widen snd amt) [LISP]SOUND or a number.span(snd, amt) [SAL](span snd amt) [LISP]SOUND or a number.swapchannels(snd) [SAL](swapchannels snd) [LISP]prologic(l, c,
r, s) [SAL](prologic l c r s) [LISP]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]SOUND, encoded as the front left channel.pl-center(snd) [SAL](pl-center snd) [LISP]SOUND, encoded as the front center channel.pl-right(snd) [SAL](pl-right snd) [LISP]SOUND, encoded as the front right channel.pl-rear(snd) [SAL](pl-rear snd) [LISP]SOUND, encoded as the rear, or surround, channel.pl-pan2d(snd, x, y) [SAL](pl-pan2d snd x y) [LISP]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]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]