Debian Codegraph @

examples/scanu-2.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 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o scanu-2.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 ; play sample
19
20 a0 loscil .8, p4, 200 ; audio sample with loop points
21 prints "\nthe drum sample has an frequency of %d\n", p4
22 outs a0, a0
23 endin
24
25 instr 2 ; inject sample
26
27 a0 loscil .5, p6, 200 ; audio injection
28 prints "...and is injected into the system..."
29 if (p6 == 0) then
30 prints "sample injection has no effect!"
31 endif
32
33 kenv linseg 1, p3*.8, .1, p3*.2, 0 ; simple envelope
34 ;scanu init, irate, ifnvel, ifnmass, ifnmatrix, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
35 scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.02, .1, .5, 0, 0, a0, 0, 2
36 ;ar scans kamp, kfreq, ifntraj, id
37 a1 scans ampdb(p4)*kenv, cpspch(p5), 7, 2
38 a2 scans ampdb(p4)*kenv, cpspch(p5)*1.01, 7, 2 ; slightly out of tune (stereo)
39 a1 *= 0.00005 ; lower amplitude due to 0dbfs = 1
40 a2 *= 0.00005
41 a1 dcblock2 a1 ; remove DC offset
42 a2 dcblock2 a2
43 outs a1, a2
44 endin
45
46 </CsInstruments>
47 <CsScore>
48 f1 0 128 7 0 64 1 64 0 ; Initial condition
49 f2 0 128 -7 1 64 .45 64 1 ; Masses
50 f3 0 16384 -23 "manual/example/string-128.matrxB" ; Spring matrix
51 f4 0 128 -7 0 64 1 64 0 ; Centering force
52 f5 0 128 -7 0 64 1 64 -0.01 ; Damping
53 f6 0 128 -7 0 128 0 ; Initial velocity
54 f7 0 128 -7 0 64 127 64 0 ; Trajectory
55 f200 0 0 1 "drumsMlp.wav" 0 0 0
56
57 i1 0.0 4 0
58 i1 34.0 4 4
59 i1 68.0 4 18
60 i2 4.0 30 88 6.00 0
61 i2 38.0 30 70 6.00 4
62 i2 72.0 30 65 6.00 18
63 e
64 </CsScore>
65 </CsoundSynthesizer>