Debian Codegraph @

examples/0dbfs-1.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in
5 -odac ;;;RT audio out
6 ; For Non-realtime ouput leave only the line below:
7 ; -o granule.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1 ; Set the 0dbfs to 1.
15
16 instr 1 ; from linear amplitude (0-1 range)
17
18 print p4
19 a1 oscil p4, 440, 1
20 outs a1, a1
21
22 endin
23
24 instr 2 ; from linear amplitude (0-32767 range)
25
26 iamp = p4 / 32767
27 print iamp
28 a1 oscil iamp, 440, 1
29 outs a1, a1
30
31 endin
32
33 instr 3 ; from dB FS
34
35 iamp = ampdbfs(p4)
36 print iamp
37 a1 oscil iamp, 440, 1
38 outs a1, a1
39
40 endin
41
42 </CsInstruments>
43 <CsScore>
44 f 1 0 16384 10 1 ; sine wave
45
46 i 1 0 1 1
47 i 1 + 1 0.5
48 i 1 + 1 0.1
49 s
50 i 2 0 1 32767
51 i 2 + 1 [32767/2]
52 i 2 + 1 [3276.7]
53 s
54 i 3 0 1 0
55 i 3 + 1 -6
56 i 3 + 1 -20
57 e
58 </CsScore>
59 </CsoundSynthesizer>