Debian Codegraph @

examples/sflooper.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in No messages
5 -odac ;;;realtime audio in
6 ; For Non-realtime ouput leave only the line below:
7 ; -o sflooper.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 isf sfload "07AcousticGuitar.sf2"
19 sfpassign 0, isf
20
21 instr 1
22
23 inum = p4
24 ivel = p5
25 kamp linsegr 1,1,1,.1,0 ; declick envelope
26 kamp = kamp * .0000015 ;scale amplitude
27 ifreq = 1 ;do not change freq from sf
28 ;"07AcousticGuitar.sf2" contains 2 samples, on notes E1 and C#4
29 ;start loop from beginning, loop .2 seconds - on the root key of these samples
30 aL,aR sflooper ivel, inum, kamp*ivel, ifreq, 0, 0, .2, .05 ; make amp velocity dependent
31 outs aL, aR
32 endin
33
34 instr 2
35
36 ifreq = p4
37 ivel = p5
38 kamp linsegr 1,1,1,.1,0 ; declick envelope
39 kamp = kamp * .0000015 ;scale amplitude
40 inum = 60 ;take soundfont samples belonging to midi index 60
41
42 ;nearly identical instr, but now takes midi note sound 60 as reference, set iflag to 1
43 aL,aR sflooper ivel, inum, kamp*ivel, ifreq, 0, 0, .2, .05, 0, 0, 0, 0, 1 ; & use ifreq for frequency
44 outs aL, aR
45
46 endin
47 </CsInstruments>
48 <CsScore>
49
50 i1 0 1 60 120 ; p4 = midi note
51 i1 + 1 62 <
52 i1 + 1 65 <
53 i1 + 1 69 10
54
55
56 i2 5 1 200 120 ; p4 = frequency
57 i2 + 1 261 <
58 i2 + 1 300 <
59 i2 + 1 1000 10
60 e
61 </CsScore>
62 </CsoundSynthesizer>