Debian Codegraph @

examples/scanhammer.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac --limiter=0.9 ;;;realtime audio out and limiter
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o scanhammer.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 2021
17
18 instr 1
19
20 initial ftgen 1, 0, p5, 10, 1 ; initial position = sine wave
21 imass ftgen 2, 0, p5, -7, .1, p5, 1 ; masses
22 istiff ftgen 3, 0, p5, -7, 0, p5*.3, 0.8*p5, p5*.7, 0 ; stiffness
23 idamp ftgen 4, 0, p5, -7, 1, p5, 1 ; damping
24 ivelo ftgen 5, 0, p5, -7, 0, p5, 0.5 ; initial velocity
25
26 iamp = .20
27 ipch = cpsmidinn(p4)
28 scanhammer 1, 1, 0, p6 ; scale initial position wave
29 asig3 scantable iamp, ipch, 1, 2, 3, 4, 5 ; set ftables in motion
30 asig foscili iamp, ipch, 1.414, .03, 1, 1 ; but use FM sound, with slow vibrato
31 asig butlp asig, 2000 ; lowpass filter
32 asig dcblock asig
33 outs asig, asig
34
35 endin
36
37 </CsInstruments>
38 <CsScore>
39 s ; note size hit
40 i1 0 10 50 128 2 ; hit very hard
41 i1 11 10 50 . 1 ; hit normally
42 i1 22 10 50 . .3 ; hit soft
43 s
44 i1 1 10 50 32 2 ; different table size
45 i1 12 10 50 . 1
46 i1 23 20 50 . .3
47 e
48 </CsScore>
49 </CsoundSynthesizer>