Debian Codegraph @

examples/limit.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;realtime audio out
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o limit.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 0dbfs = 1
14 nchnls = 2
15
16 instr 1 ; Limit / Mirror / Wrap
17
18 igain = p4 ;gain
19 ilevl1 = p5 ; + level
20 ilevl2 = p6 ; - level
21 imode = p7 ;1 = limit, 2 = mirror, 3 = wrap
22
23 ain soundin "fox.wav"
24 ain = ain*igain
25
26 if imode = 1 goto limit
27 if imode = 2 goto mirror
28
29 asig wrap ain, ilevl2, ilevl1
30 goto outsignal
31
32 limit:
33 asig limit ain, ilevl2, ilevl1
34 goto outsignal
35
36 mirror:
37 asig mirror ain, ilevl2, ilevl1
38 outsignal:
39
40 outs asig*.5, asig*.5 ;mind your speakers
41
42 endin
43
44 </CsInstruments>
45 <CsScore>
46
47 ; Gain +Levl -Levl Mode
48 i1 0 3 4.00 .25 -1.00 1 ;limit
49 i1 4 3 4.00 .25 -1.00 2 ;mirror
50 i1 8 3 4.00 .25 -1.00 3 ;wrap
51 e
52 </CsScore>
53 </CsoundSynthesizer>