xscans

xscans — Fast scanned synthesis waveform and the wavetable generator.

Description

Plugin opcode in scansyn.

Experimental version of scans. Allows much larger matrices and is faster and smaller but removes some (unused?) flexibility. If liked, it will replace the older opcode as it is syntax compatible but extended.

Syntax

ares xscans kamp, kfreq, ifntraj, id [, iorder]

Initialization

ifntraj -- table containing the scanning trajectory. This is a series of numbers that contains addresses of masses. The order of these addresses is used as the scan path. It should not contain values greater than the number of masses, or negative numbers. See the introduction to the scanned synthesis section.

id -- If positive, the ID of the opcode. This will be used to point the scanning opcode to the proper waveform maker. If this value is negative, the absolute of this value is the wavetable on which to write the waveshape. That wavetable can be used later from an other opcode to generate sound. The initial contents of this table will be destroyed.

iorder (optional, default=0) -- order of interpolation used internally. It can take any value in the range 1 to 4, and defaults to 4, which is quartic interpolation. The setting of 2 is quadratic and 1 is linear. The higher numbers are slower, but not necessarily better.

Performance

kamp -- output amplitude. Note that the resulting amplitude is also dependent on instantaneous value in the wavetable. This number is effectively the scaling factor of the wavetable.

kfreq -- frequency of the scan rate

Examples

Here is an example of the xscans opcode. It uses the file xscans.csd.

Example 1359. Example of the xscans opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac    ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o xscans.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1
;the matrices can be found in /manual/examples

instr 1	; Plain scanned syntnesis

  a0       =           0
           xscanu      1, .01, 6, 2, "128,8-cylinder.XmatrxT", 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 0, 0
  a1       xscans      .7, cpspch(p4), 7, 0, 1
           outs        a1, a1
endin


instr 2	; Scan synthesis with audio injection and dual scan paths
	; tap the mic or sing to inject audio into the resonators

  a0,aa    ins
  a0       =           a0/.8
           xscanu      1, .01, 6, 2, "128,8-grid.XmatrxT", 14, 5, 2, .01, .05, -.05, .1, .5, 0, 0, a0, 0, 0
  a1       xscans      .5, cpspch(7.00), 7, 0, 1
  a2       xscans      .5, cpspch(7.001), 77, 0, 1
           outs        a1+a2,a1+a2
endin 


instr 3	; Vibrating structure with audio injection
	; Tap the MIC - to inject audio into the resonators

  a0,aa    ins          
  a0       =          a0/.8
           xscanu     1, .01, 6, 2, "128-stringcircular.XmatrxT", 14, 5, 2, .01, .05, -.05, .25, .75, 0, 0, a0, 0, 1
endin


instr 4	; Modulated scanners

  i1       bexprnd     5
  i2       bexprnd     1
  ko       oscil       i1, i2, 9
  ka1      oscili      .5, .15*8, p7
  ka2      oscili      .5, .15*8, p8
  kf       oscili      1, .15, p4
  kf       =           2^(kf/12)*p6*440+ko
  a1       xscans      p9*ka1, kf+i1, 777, 1, 1
  a2       xscans      p9*ka2, (kf+i1)*2.1, 77, 1, 1
           outs        a1+a2, a1+a2
endin

</CsInstruments>
<CsScore>
; Initial condition
f1 0 128 7 0 64 1 64 0
; Masses
f2 0 128 -7 1 128 1
; Centering force
f4  0 128 -7 0 128 2
f14 0 128 -7 2 64 0 64 2
; Damping
f5 0 128 -7 1 128 1
; Initial velocity
f6 0 128 -7 -.0 128 .0
; Trajectories
f7 0 128 -5 .001 128 128
f777 0 128 -23 "128-stringcircular" ;??
f77 0 128 -23 "128-spiral-8,16,128,2,1over2.traj"
; Sine
f9 0 16384 10 1

; Pitch tables
f100 0 1024 -7 +3 128 +3 128 -2 128 -2 128 +0 128 +0 128 -4 128 -4 128 +3
f101 0 1024 -7 -2 128 -2 128 -2 128 -2 128 -5 128 -5 128 -4 128 -4 128 -2
f102 0 1024 -7 +3 128 +3 128 +2 128 +2 128 +0 128 +0 128 +0 128 +0 128 +3
f103 0 1024 -7 +7 128 +7 128 +5 128 +5 128 +3 128 +3 128 +3 128 +3 128 +7 

; Amplitude tables
f200 0 1024 7 1 128 0 128 0 127 0 1 1 128 0 128 0 127 0 1 1 128 0 127 0 1 1
f201 0 1024 7 0 127 0 1 1 127 0 1 1 128 0 127 0 1 1 127 0 1 1 128 0 127 0 1 1 127 0 1 1
f202 0 1024 7 1 127 0 1 1 127 0 1 1 127 0 1 1 127 0 1 1 127 0 1 1 127 0 1 1 127 0 1 1 127 0 1 
f203 0 1024 7 1 1024 0

;----------------------------------

; Note list
i1 0 10 6.00                                 
s
i2 1 10
s
i3 1 23
i4 1 23  101 1 .5  200 202 1.5
i4 . .   102 0 .5  200 201 1
i4 . .   103 0 .5  200 201 1 
i4 . .   100 0 .25 200 200 2
e
</CsScore>
</CsoundSynthesizer>


For similar examples, see the documentation on scans.

See Also

More information on Scanned Synthesis (as well as several other matrices) is available on the Scanned Synthesis page at cSounds.com.

Also an article on these opcodes: http://www.csounds.com/stevenyi/scanned/yi_scannedSynthesis.html , written by Steven Yi

scans, xscanu

Credits

Written by John ffitch.

New in version 4.20