spsend

spsend — Generates output signals based on a previously defined space opcode.

Description

spsend depends upon the existence of a previously defined space. The output signals from spsend are derived from the values given for xy and reverb in the space and are ready to be sent to local or global reverb units (see example below).

Syntax

a1, a2, a3, a4 spsend

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.

Examples

instr 1
  asig    ;some audio signal
  ktime              line  0, p3, p10
  a1, a2, a3, a4     space asig,1, ktime, .1
  ar1, ar2, ar3, ar4 spsend        
  
  ga1 = ga1+ar1
  ga2 = ga2+ar2
  ga3 = ga3+ar3
  ga4 = ga4+ar4
  
                     outq a1, a2, a3, a4
endin

instr 99 ; reverb instrument
          
  a1 reverb2 ga1, 2.5, .5
  a2 reverb2 ga2, 2.5, .5
  a3 reverb2 ga3, 2.5, .5
  a4 reverb2 ga4, 2.5, .5
  
     outq a1, a2, a3, a4
  ga1=0
  ga2=0
  ga3=0
  ga4=0
        

In the above example, the signal, asig, is moved according to the data in Function #1 indexed by ktime. space sends the appropriate amount of the signal internally to spsend. The outputs of the spsend are added to global accumulators in a common Csound style and the global signals are used as inputs to the reverb units in a separate instrument.

space can 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.

instr 1
  ...
  a1, a2, a3, a4     space asig, 0, 0, .1, p4, p5
  ar1, ar2, ar3, ar4 spsend
  
  ga1=ga1+ar1
  ga2=ga2+ar2
                     outs  a1, a2
endin

instr 99 ; reverb....
  ....
endin
        

A few notes: p4 and p5 are the X and Y values

  ;place the sound in the left speaker and near
    i1 0 1 -1 1
  ;place the sound in the right speaker and far
    i1 1 1 45 45
  ;place the sound equally between left and right and in the middle ground distance
    i1 2 1 0 12
e
        

The next example shows a simple intuitive use of the distance values returned by spdist to simulate Doppler shift.

  ktime              line   0, p3, 10
  kdist              spdist 1, ktime
  kfreq = (ifreq * 340) / (340 + kdist)
  asig               oscili iamp, kfreq, 1
  
  a1, a2, a3, a4     space  asig, 1, ktime, .1
  ar1, ar2, ar3, ar4 spsend
        

The same function and time values are used for both spdist and space. This insures that the distance values used internally in the space unit will be the same as those returned by spdist to give the impression of a Doppler shift!

See Also

space, spdist

Credits

Author: Richard Karpen
Seattle, WA USA
1998

New in Csound version 3.48