Debian Codegraph @

examples/scansmap.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac --limiter=0.95 ;;;realtime audio out & and limit loud sounds
5 ; For Non-realtime ouput leave only the line below:
6 ; -o scansmao.wav -W ;;; for file output any platform
7 </CsOptions>
8 <CsInstruments>
9
10 sr=44100
11 ksmps=32
12 nchnls=2
13 0dbfs = 1
14
15 ; by Menno Knevel - 2024
16 ; listen carefully: changes are subtle as only one node of the 128 is replaced each time!
17
18 instr 1 ;replace 2 nodes- first 5 then 89
19
20 a0 init 0
21 irate = .002 ; rather fast scanning rate
22 ; scanu2 init, irate, ifndisplace, ifnmass, ifnmatrix, ifncentr, ifndamp, kmass,
23 scanu2 1, irate, 6, 2, 3, 4, 5, 2,\
24 9, .01, .01, .1, .9, 0, 0, a0, 0, 1
25 ; kmtrxstiff, kcentr, kdamp, ileft, iright, kpos, kdisplace, ain, idisp, id
26 kpos,kvel scanmap 1, 1, 1, p4 ; just read what is going on with node
27 scansmap p5, p6, 1, 1, 1, p4 ; set new parameters for this node
28
29 prints "\nnode %d: set position to %0.1f, set velocity to %0.1f \n", p4, p5, p6
30 printks " present amplitude = %f, position = %f\n", .2, kvel, kpos
31
32 a1 scans ampdb(87), cpspch(7.00), 7, 1
33 a1 butlp a1, 1500 ; low pass filter
34 asig dcblock a1
35 outs asig*.00002, asig*.00002
36
37 endin
38
39 </CsInstruments>
40 <CsScore>
41
42 f1 0 128 -7 0 28 0 2 1 2 0 96 0 ; a pluck that is 10 points wide on the surface
43 f2 0 128 -7 1 128 1 ; Masses
44 f3 0 16384 -23 "string-128.matrxB" ; Spring matrix
45 f4 0 128 -7 1 128 1 ; uniform initial centering
46 f5 0 128 -7 1 128 1 ; uniform damping
47 f6 0 128 -7 .01 128 .01 ; uniform initial velocity
48 f7 0 128 -7 1 128 128 ; trajectory
49
50 i1 0.0 5 5 0 0
51 i1 5.0 5 89 0 0
52 i1 11.0 5 5 0 1
53 i1 16.0 5 89 0 1
54 i1 22.0 5 5 1 0
55 i1 27.0 5 89 1 0
56 i1 33.0 5 5 1 1
57 i1 38.0 5 89 1 1
58 e
59
60 </CsScore>
61 </CsoundSynthesizer>