| 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 scanu.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 = 0 ; no external input |
| 21 |
; scanu init, irate, ifnvel, ifnmass, ifnmatrix, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id |
| 22 |
scanu p7, p6, 6, 2, 3, 4, 5, 2, .1, .1, -.02, .1, .5, 0, 0, a0, 0, 2 |
| 23 |
|
| 24 |
if (p7 == -1) then |
| 25 |
prints "\nthe hammer option!\n" |
| 26 |
else |
| 27 |
prints "\ninitial position of the masses...\n" |
| 28 |
endif |
| 29 |
;ar scans kamp, kfreq, ifntraj, id |
| 30 |
a1 scans ampdb(p4), cpspch(p5), 7, 2 |
| 31 |
a2 scans ampdb(p4), cpspch(p5)*1.01, 7, 2 ; slightly out of tune |
| 32 |
a1 *= 0.00006 ; lower amplitude due to 0dbfs = 1 |
| 33 |
a2 *= 0.00006 |
| 34 |
a1 dcblock2 a1 ; remove DC offset |
| 35 |
a2 dcblock2 a2 |
| 36 |
outs a1, a2 |
| 37 |
|
| 38 |
endin |
| 39 |
|
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
|
| 43 |
f1 0 128 7 0 64 1 64 0 ; Initial condition |
| 44 |
f2 0 128 -7 1 64 .45 64 1 ; Masses |
| 45 |
f3 0 16384 -23 "string-128.matrxB" ; Matrix, a binary one. Can be found in manual/examples |
| 46 |
f4 0 128 -7 0 64 1 64 0 ; Centering force |
| 47 |
f5 0 128 -7 0 64 1 64 0 ; Damping |
| 48 |
f6 0 128 -7 0 128 0 ; Initial velocity |
| 49 |
f7 0 128 -7 0 64 127 64 0 ; Trajectory |
| 50 |
|
| 51 |
i1 0.0 8 86 6.00 0.001 1 |
| 52 |
i1 8.0 8 89 6.01 0.001 -1 |
| 53 |
i1 17.0 10 86 6.00 0.005 1 |
| 54 |
i1 27.0 10 89 6.01 0.005 -1 |
| 55 |
i1 38.0 120 86 6.00 0.1 1 |
| 56 |
i1 159.0 120 89 6.01 0.1 -1 |
| 57 |
e |
| 58 |
</CsScore> |
| 59 |
</CsoundSynthesizer> |