space
Distributes an input signal among 4 channels using cartesian coordinates.
It uses Cartesian xy coordinates to calculate the balance of the outputs. The xy coordinates can be defined in a separate text file and accessed through a Function statement in the score using Gen28, or they can be specified using the optional kx, ky arguments. The advantages to the former are:
- A graphic user interface can be used to draw and edit the trajectory through the Cartesian plane
- The file format is in the form time1 X1 Y1 time2 X2 Y2 time3 X3 Y3 allowing the user to define a time-tagged trajectory
space then allows the user to specify a time pointer (much as is used for pvoc, lpread and some other units) to have detailed control over the final speed of movement.
Syntax
Initialization
ifn -- number of the stored function created using Gen28. This function generator reads a text file which contains sets of three values representing the xy coordinates and a time-tag for when the signal should be placed at that location. The file should look like:
If that file were named “move” then the Gen28 call in the score would like:
Gen28 takes 0 as the size and automatically allocates memory. It creates values to 10 milliseconds of resolution. So in this case there will be 500 values created by interpolating X1 to X2 to X3 and so on, and Y1 to Y2 to Y3 and so on, over the appropriate number of values that are stored in the function table. In the above example, the sound will begin in the left front, over 1 second it will move to the right front, over another second it move further into the distance but still in the right front, then in just 1/10th of a second it moves to the left rear, a bit distant. Finally over the last .9 seconds the sound will move to the right rear, moderately distant, and it comes to rest between the two left channels (due west!), quite distant. Since the values in the table are accessed through the use of a time-pointer in the space unit, the actual timing can be made to follow the file's timing exactly or it can be made to go faster or slower through the same trajectory. If you have access to the GUI that allows one to draw and edit the files, there is no need to create the text files manually. But as long as the file is ASCII and in the format shown above, it doesn't matter how it is made!
Important
If ifn is 0, then space will take its values for the xy coordinates from kx and ky.
Performance
The configuration of the xy coordinates in space places the signal in the following way:
- a1 is -1, 1
- a2 is 1, 1
- a3 is -1, -1
- a4 is 1, -1
This assumes a loudspeaker set up as a1 is left front, a2 is right front, a3 is left back, a4 is right back. Values greater than 1 will result in sounds being attenuated, as if in the distance. space considers the speakers to be at a distance of 1; smaller values of xy can be used, but space will not amplify the signal in this case. It will, however balance the signal so that it can sound as if it were within the 4 speaker space. x=0, y=1, will place the signal equally balanced between left and right front channels, x=y=0 will place the signal equally in all 4 channels, and so on. Although there must be 4 output signals from space, it can be used in a 2 channel orchestra. If the xy's are kept so that y>=1, it should work well to do panning and fixed localization in a stereo field.
asig -- input audio signal.
ktime -- index into the table containing the xy coordinates. If used like:
with the file “move” described above, the speed of the signal's movement will be exactly as described in that file. However:
the signal will move at half the speed specified. Or in the case of:
the signal will move in the reverse direction as specified and 3 times slower! Finally:
will cause the signal to move only from the place specified in line 3 of the text file to the place specified in line 5 of the text file, and it will take 10 seconds to do it.
kreverbsend -- the percentage of the direct signal that will be factored along with the distance as derived from the xy coordinates to calculate signal amounts that can be sent to reverb units such as reverb, or reverb2.
kx, ky -- when ifn is 0, space and spdist will use these values as the xy coordinates to localize the signal.
Examples
Here is an example of the space opcode. It uses the file space_quad.csd.
space can be useful for quad and stereo panning as well as fixed placed of sounds anywhere between two loudspeakers. Below is an example of the fixed placement of sounds in a stereo field using xy values from the score instead of a function table. It uses the file space_stereo.csd.
spdist demonstrates an example of a simple intuitive use of the distance values to simulate Doppler shift.
See also
Panning and Spatialization: Amplitude spatialization
Credits
Author: Richard Karpen
Seattle, WA USA
1998
New in Csound version 3.48