scanmap
Allows the position and velocity of a node in a scanned process to be read.
Plugin opcode in scansyn.
Syntax
kpos, kvel scanmap iscan, kamp, kvamp [, iwhich]
Initialization
iscan -- which scan process to read
iwhich (optional) -- which node to sense. The default is 0.
kamp -- amount to amplify the kpos value.
kvamp -- amount to amplify the kvel value.
The internal state of a node is read. This includes its position and velocity. They are amplified by the kamp and kvamp values.
Examples
Here is an example of the scanmap opcode. It uses the file scanmap.csd.
Example of the scanmap opcode. |
---|
| <CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac ;;;RT audio out
;-iadc ;;;uncomment -iadc for RT audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o scanmap.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr scannode
a0 init 0
irate = .001
; scanu2 init, irate, ifndisplace, ifnmass, ifnmatrix, ifncentr, ifndamp, kmass,
; kmtrxstiff, kcentr, kdamp, ileft, iright, kpos, kdisplace, ain, idisp, id
scanu2 1, irate, 6, 2, 3, p5, 5, 2, 9, .01, .01, .1, .9, 0, 0, a0, 0, 2
kpos,kvel scanmap 2, 100,1, p4 ; amplify the kpos value 100 times
display kpos, .25 ; display is updated every .25 of a second
asig poscil .5+kvel, 150+kpos ; use moving velocity and position of the node
outs asig, asig
endin
</CsInstruments>
<CsScore>
f1 0 128 10 1 ; Initial displacement condition: sine
f2 0 128 -7 1 128 1 ; Masses
f3 0 16384 -23 "string-128.matrxB" ; Spring matrices
;-------------------------------------
; 2 different Centering forces
f44 0 128 -7 1 128 1 ; uniform initial centering
f4 0 128 -7 .001 128 1 ; ramped centering
;-------------------------------------
f5 0 128 -7 1 128 1 ; uniform damping
f6 0 128 -7 .01 128 .01 ; uniform initial velocity
f7 0 128 -5 .001 128 128 ; Trajectory
s; node
i"scannode" 0 10 0 4 ; uniform initial centering ramped centering
i"scannode" 11 10 64 4 ; reading 3 nodes
i"scannode" 22 10 127 4 ; 0 - 64 - 127
s; node
i"scannode" 0 10 0 44 ; uniform initial centering
i"scannode" 11 10 64 44 ; reading 3 nodes
i"scannode" 22 10 127 44 ; 0 - 64 - 127
e
</CsScore>
</CsoundSynthesizer>
|
Here is another example of the scanmap opcode. It uses the file scanmap_matrxT.csd.
Second example of the scanma opcode. |
---|
| <CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out Audio in
-odac ; -iadc ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o scanmap_matrxT.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr scanmap_Additive
a0 init 0
kp[] init 16
kv[] init 16
giTableKP ftgen 100, 0, -16, 2, 0
giTableKV ftgen 101, 0, -16, 2, 0
scanu2 -1, .1, 6, 2, 3, 4, 5, 2, 10, .001, .01, .1, .9, 0, 0, a0, 1, 2
kp,kv scanmap 2, 1000, 2
copya2ftab kp, giTableKP
copya2ftab kv, giTableKV
a1 poscil ampdbfs(p4)*kv[8], cpsmidinn(p5)+kp[8]
a2 poscil ampdbfs(p4)*kv[13], cpsmidinn(p5)+kp[13]
a3 poscil ampdbfs(p4)*kv[5], cpsmidinn(p5)+kp[5]
a4 poscil ampdbfs(p4)*kv[1], cpsmidinn(p5)+kp[1]
kamp line 3, p3, 0.01
outs (a1+a4)*kamp, (a2+a3) * kamp
endin
</CsInstruments>
<CsScore>
f1 0 16 10 1 ; initial displacement condition (sine shape)
f2 0 16 -7 1 16 1 ; uniform masses
f3 0 0 -44 "string_with_extras-16.matrxT"
f4 0 16 -7 .001 16 1 ; ramped centering
f5 0 16 -7 .1 16 1 ; ramped damping
f6 0 16 -7 .01 16 .01 ; uniform initial velocity
i "scanmap_Additive" 0 15 -1 72
e
</CsScore>
</CsoundSynthesizer>
|
See also
Scanned Synthesis
More information on the Scanned Synthesis opcodes: Working with Scanned Synthesis, written by Steven Yi, and some tutorials by Richard Boulanger.
Credits
Author: John ffitch
New in version 6.17