| 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 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o scanu2.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
; by Menno Knevel 2024 |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
a0 init 0 ; no audio injection |
| 21 |
irate = .01 |
| 22 |
kenv adsr .0001, 1, .7, .1 ; envelope |
| 23 |
|
| 24 |
if (p6 == 1) then |
| 25 |
prints "\ninitial displacement condition = ramp" |
| 26 |
elseif (p6 == 11) then |
| 27 |
prints "\ninitial displacement condition = sine (hammer???)" |
| 28 |
else |
| 29 |
prints "\ninitial displacement condition = a pluck that is 10 points wide on the surface" |
| 30 |
endif |
| 31 |
|
| 32 |
if (p7 == 3) then |
| 33 |
prints "\n (binary matrix)\n\n" |
| 34 |
else |
| 35 |
prints "\n (text matrix)\n\n" |
| 36 |
endif |
| 37 |
|
| 38 |
; scanu init, irate, ifndisplace, ifnmass, ifnmatrix, ifncentr, ifndamp, kmass, |
| 39 |
; kmtrxstiff, kcentr, kdamp, ileft, iright, kpos, kdisplace, ain, idisp, id |
| 40 |
scanu2 p6, irate, 6, 2, p7, 4, 5, 2, 9, .01, .01, .1, .9, 0, 0, a0, 1, 2 |
| 41 |
|
| 42 |
;ar scans kamp, kfreq, ifntraj, id |
| 43 |
asig scans ampdb(p4)*kenv, cpspch(p5), 7, 2 |
| 44 |
outs asig*.00004, asig*.00004 ; lower volume due to 0dbfs=1 |
| 45 |
endin |
| 46 |
|
| 47 |
</CsInstruments> |
| 48 |
<CsScore> |
| 49 |
; Initial displacement condition |
| 50 |
f1 0 128 -7 0 64 1 64 0 ; ramp |
| 51 |
f11 0 128 10 1 ; sine hammer |
| 52 |
f111 0 128 -7 0 28 0 2 1 2 0 96 0 ; a pluck that is 10 points wide on the surface |
| 53 |
|
| 54 |
; Masses |
| 55 |
f2 0 128 -7 1 128 1 |
| 56 |
|
| 57 |
; Spring matrices |
| 58 |
f3 0 16384 -23 "/manual/examples/string-128.matrxB" |
| 59 |
f33 0 16384 -44 "/manual/examples/cylinder_128.matrxT" |
| 60 |
|
| 61 |
; Centering force |
| 62 |
f4 0 128 -7 1 128 1 ; uniform initial centering |
| 63 |
; 0 128 -7 .001 128 1 ; ramped centering |
| 64 |
|
| 65 |
; Damping |
| 66 |
f5 0 128 -7 1 128 1 ; uniform damping |
| 67 |
|
| 68 |
; Initial velocity - (displacement, vel, and acceleration |
| 69 |
; Acceleration is from stiffness matrix pos effect - increases acceleration |
| 70 |
f6 0 128 -7 .01 128 .01 ; uniform initial velocity |
| 71 |
|
| 72 |
; exponential Trajectory |
| 73 |
f7 0 128 -5 .001 128 128 |
| 74 |
|
| 75 |
i1 0 6 88 7.00 1 3 |
| 76 |
i1 7 2 88 5.00 1 3 |
| 77 |
i1 9 2 88 6.00 1 3 |
| 78 |
|
| 79 |
i1 12 6 86 7.00 11 3 |
| 80 |
i1 19 2 86 5.00 11 3 |
| 81 |
i1 21 2 86 6.00 11 3 |
| 82 |
|
| 83 |
i1 24 6 90 7.00 111 3 |
| 84 |
i1 31 2 90 5.00 111 3 |
| 85 |
i1 33 2 90 6.00 111 3 |
| 86 |
|
| 87 |
i1 37 6 88 7.00 1 33 |
| 88 |
i1 44 2 88 5.00 1 33 |
| 89 |
i1 46 2 88 6.00 1 33 |
| 90 |
|
| 91 |
i1 49 6 85 7.00 11 33 |
| 92 |
i 156 2 85 5.00 11 33 |
| 93 |
i1 58 2 85 6.00 11 33 |
| 94 |
|
| 95 |
i1 61 6 92 7.00 111 33 |
| 96 |
i1 68 2 92 5.00 111 33 |
| 97 |
i1 70 2 92 6.00 111 33 |
| 98 |
e |
| 99 |
</CsScore> |
| 100 |
</CsoundSynthesizer> |