scanu

scanu — Compute the waveform and the wavetable for use in scanned synthesis.

Description

Plugin opcode in scansyn.

Compute the waveform and the wavetable for use in scanned synthesis.

Syntax

scanu init, irate, ifndisplace,
    ifnmass, ifnmatrix, ifncentr, ifndamp, kmass, kmtrxstiff, kcentr,
    kdamp, ileft, iright, kpos, kdisplace, ain, idisp, id

Initialization

init -- the initial position of the masses. If this is a negative number, then the absolute of init signifies the table to use as a hammer shape. If init > 0, the length of it should be the same as the intended mass number, otherwise it can be anything.

irate -- the amount of time between successive updates of the mass state. Kind of like the sample period of the system. If the number is big, the string will update at a slow rate showing little timbral variability; otherwise it will change rapidly resulting in a more dynamic sound.

ifndisplace -- the ftable that contains the initial velocity for each mass. It should have the same size as the intended mass number.

ifnmass -- ftable that contains the mass of each mass. It should have the same size as the intended mass number.

ifnmatrix -- ftable that contains the spring stiffness of each connection. It should have the same size as the square of the intended mass number. The data ordering is a row after row dump of the connection matrix of the system.

ifncentr -- ftable that contains the centering force of each mass. It should have the same size as the intended mass number.

ifndamp -- the ftable that contains the damping factor of each mass. It should have the same size as the intended mass number.

ileft -- If init < 0, the position of the left hammer (ileft = 0 is hit at leftmost, ileft = 1 is hit at rightmost).

iright -- If init < 0, the position of the right hammer (iright = 0 is hit at leftmost, iright = 1 is hit at rightmost).

idisp -- If 0, no display of the masses is provided.

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.

Performance

kmass -- scales the masses

kmtrxstiff -- scales the spring stiffness.

kcentr -- scales the centering force

kdamp -- scales the damping

kpos -- position of an active hammer along the string (kpos = 0 is leftmost, kpos = 1 is rightmost). The shape of the hammer is determined by init and the power it pushes with is kstrngth.

kdisplace -- power that the active hammer uses.

ain -- audio input that adds to the velocity of the masses. Amplitude should not be too great.

Examples

Here is an example of the scanu opcode. It uses the files scanu-musical.csd and MIDIpad.mid.

Example 920. Example of the scanu opcode.

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

<CsoundSynthesizer>
<CsOptions>
-odac -d -F "MIDIpad.mid"
; For Non-realtime ouput leave only the line below:
; -o scanu-musical.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; by Shengzheng Zhang

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

itmp  ftgen 1, 0, 128, 7, 0, 64, 1,64, 0      ; generating all bunch of tables needed
itmp  ftgen 2, 0, 128, -7, 1, 128, 1
itmp  ftgen 3, 0, 16384, -23, "string-128.matrxB"
itmp  ftgen 4, 0, 128,-7 ,0.5 ,128, 0
itmp  ftgen 5, 0, 128, -7, 1, 128, 1
itmp  ftgen 6, 0, 128, -7, 0, 128, 0
itmp  ftgen 7, 0, 128, -7, .001, 128,128

gal   init 0                                 ; getting reverb and delay ready
gar   init 0
gavl  init 0
gavr  init 0

instr 1
kpan    randh 1, 3                           ; random panning
kpan    port kpan, 0.05 ;make the panning change not so quick
kpitch  cpsmidib 12
ipitch  cpsmidi
kenvm   madsr 0.02, 0.6, 0.2, 1
kenv2   madsr 0.1, 0.6, 0.8, 1
kenv3   madsr 0.8, 0.6, 0.8, 1
kvib    lfo 1, 5
ifnvel  = 1
ifnmass = 2
ifnstif = 3
ifncentr = 4
ifndamp = 5
kstif   = 0.3 + 0.1*kvib * kenv3
kmass   = 10-(5*kenvm)                      ; modulated mass
kcentr  = 0.1
kdamp   = -0.02
ileft   = 0.2
iright  = 0.8
kpos    = 0.2
kstrngth = 0.005
;setups for scan synthesis
a2      madsr 0.002, 0.01, 0.001, 0 ;get a initial pick, but seemed like not working 
scanu 1, 0.1,ifnvel, ifnmass,ifnstif,ifncentr, ifndamp,kmass, kstif, kcentr, kdamp, ileft, iright,kpos,kstrngth, a2*0.5, 0.2, 1
a1      scans .01*kenv2, kpitch+kpitch*kvib*kenv3*0.01, 7, 1
a1      dcblock a1
a1      butterlp	a1, kpitch*8
a1      butterlp	a1, kpitch*12
al      = a1*kpan
ar      = a1*(1-kpan)
        outs al, ar
        vincr gal, al
        vincr gar, ar
        vincr gavl, al
        vincr gavr, ar
endin

instr 2
abuf    delayr 5
adl     deltap 0.3
        delayw gal + (adl * 0.2)

abuf    delayr 5
adr     deltap 0.4
        delayw gal + (adr * 0.2)
        
        outs adl, adr
        clear gal
        clear gar
endin

instr 3
adl, adr reverbsc gavl, gavr, 0.85, 12000
        outs adl, adr
        clear gavl
        clear gavr
endin

</CsInstruments>
<CsScore>
i2 0 70
i3 0 70
e
</CsScore>
</CsoundSynthesizer>


See Also

More information on this opcode: http://www.csounds.com/stevenyi/scanned/yi_scannedSynthesis.html , written by Steven Yi

Credits

Author: Paris Smaragdis
MIT Media Lab
Boston, Massachussetts USA
March 2000

New in Csound version 4.05