Debian Codegraph @

examples/powoftwo.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 poweroftwo.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 instr 1 ; bit reduction for Lo-Fi sound
17
18 iBits = p4 ;bit depth
19 iQuantize = powoftwo(iBits) ;find number of discrete steps for this bit depth
20 iQuantize = iQuantize*0.5 ;half the number of steps for each side of a bipolar signal
21 print iQuantize
22 asig soundin "fox.wav"
23 asig = round(asig * iQuantize) / iQuantize ;quantize audio signal (bit reduce)
24 outs asig, asig
25
26 endin
27 </CsInstruments>
28 <CsScore>
29 ; bits
30 i1 0 3 16
31 i1 ^+3 . 12
32 i1 ^+3 . 8
33 i1 ^+3 . 4
34 i1 ^+3 . 2
35 i1 ^+3 . 1
36
37 e
38 </CsScore>
39 </CsoundSynthesizer>
40