Debian Codegraph @

src/Examples/CsoundQt/Getting Started/Basics/Routing.csd

raw
1 /* Getting started.. 1.8 Routing
2 Combining Csound's Opcodes is based on the same signal flow principle you have with most analog synths.
3
4 As a first example (instr 1) a raw SAWTOOTH oscillator is directly sent to the computer audio output.
5 SAW -> Output
6
7 In the second instrument (instr 2), the same SAWTOOTH Oscillator will first pass a resonant low pass filter, before the filtered signal goes to the audio output.
8 SAW -> LP -> Output
9
10 The third example (instr 3) shows, how the frequency of the SAW can be modulated by a low frequency sine oscillator (LFO).
11 LFO ~> SAW -> LP -> Output
12
13 In the last example (instr 4) the same LFO is now used to modulate the filters frequency and not the SAW pitch anymore.
14 SAW -> LP -> Output
15 ^
16 LFO
17 */
18
19 <CsoundSynthesizer>
20 <CsOptions>
21 </CsOptions>
22 <CsInstruments>
23
24
25 sr = 44100
26 ksmps = 128
27 nchnls = 2
28 0dbfs = 1
29
30 #define SAWFREQ #150# ;freq in Hz
31 /*
32 The expression #define is used for textual replacement, also called macros.
33 Here it is used to paste the same frequency-value (150) in every instrument. If you want to change the SAW frequency for all instruments at once, just change the #150# to the desired Hz.
34 Find out more about macro usage in the Csound Manual: 1. Overview->Syntax of the Orchestra->Macros
35 direct: OrchMacros (Shift+F1)
36 */
37
38
39 instr 1
40 aSaw oscili 0.2, $SAWFREQ, 1 ;$-sign calls the defined macro
41 outs aSaw, aSaw
42 endin
43
44 instr 2
45 aSaw oscili 0.2, $SAWFREQ, 1
46 aFiltered lowpass2 aSaw, 200, 5
47 outs aFiltered, aFiltered
48 endin
49
50 instr 3
51 kSinLFO oscili 50, 3, 2
52 aSaw oscili 0.2, $SAWFREQ+kSinLFO, 1
53 aFiltered lowpass2 aSaw, 200, 5
54 outs aFiltered, aFiltered
55 endin
56
57 instr 4
58 kSinLFO oscili 50, 3, 2
59 aSaw oscili 0.2, $SAWFREQ, 1
60 aFiltered lowpass2 aSaw, 200+kSinLFO, 5
61 outs aFiltered, aFiltered
62 endin
63
64 </CsInstruments>
65 ; In this example we use the score to play the four different instruments one after the other for 2 seconds, with a one second break inbetween.
66 <CsScore>
67 f 1 0 1024 7 -1 1024 1 ;saw-waveform functiontable
68 f 2 0 1024 10 1 ;sine-waveform functiontable
69 ; instr start dur
70 i1 0 2
71 i2 3 2
72 i3 6 2
73 i4 9 2
74 e
75 </CsScore>
76 </CsoundSynthesizer>
77 ; written by Alex Hofmann (Nov. 2009) - Incontri HMT-Hannover
78 <bsbPanel>
79 <label>Widgets</label>
80 <objectName/>
81 <x>1013</x>
82 <y>279</y>
83 <width>563</width>
84 <height>397</height>
85 <visible>true</visible>
86 <uuid/>
87 <bgcolor mode="background">
88 <r>160</r>
89 <g>158</g>
90 <b>162</b>
91 </bgcolor>
92 <bsbObject version="2" type="BSBScope">
93 <objectName/>
94 <x>8</x>
95 <y>110</y>
96 <width>268</width>
97 <height>148</height>
98 <uuid>{ee2f60f5-c718-47df-ad36-170aa0c4f1c7}</uuid>
99 <visible>true</visible>
100 <midichan>0</midichan>
101 <midicc>-3</midicc>
102 <value>-255.00000000</value>
103 <type>scope</type>
104 <zoomx>2.00000000</zoomx>
105 <zoomy>1.00000000</zoomy>
106 <dispx>1.00000000</dispx>
107 <dispy>1.00000000</dispy>
108 <mode>0.00000000</mode>
109 </bsbObject>
110 <bsbObject version="2" type="BSBLabel">
111 <objectName/>
112 <x>8</x>
113 <y>20</y>
114 <width>269</width>
115 <height>86</height>
116 <uuid>{c2f4b44b-da01-4878-83a8-fbfe5cc43a54}</uuid>
117 <visible>true</visible>
118 <midichan>0</midichan>
119 <midicc>-3</midicc>
120 <label>See how the SAW output-waveform changes, because of the used LP filter and the modulation.</label>
121 <alignment>left</alignment>
122 <font>Lucida Grande</font>
123 <fontsize>14</fontsize>
124 <precision>3</precision>
125 <color>
126 <r>0</r>
127 <g>0</g>
128 <b>0</b>
129 </color>
130 <bgcolor mode="nobackground">
131 <r>255</r>
132 <g>255</g>
133 <b>255</b>
134 </bgcolor>
135 <bordermode>noborder</bordermode>
136 <borderradius>1</borderradius>
137 <borderwidth>1</borderwidth>
138 </bsbObject>
139 </bsbPanel>
140 <bsbPresets>
141 </bsbPresets>