Debian Codegraph @

src/Examples/CsoundQt/Widgets/Tableplot_Widget.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4
5 </CsOptions>
6 <CsInstruments>
7
8 sr = 44100
9 ksmps = 64
10 nchnls = 2
11 0dbfs = 1
12
13 /*
14 This is the example file for the Table Plot Widget
15
16 This widget allows to visualize the contents of a table in
17 real-time. To set the table number to plot send the table
18 number to its channel. To update the plot just send -1 and
19 the last set table will be updated.
20
21 The widget also accepts string values. The table can be set
22 via "@set tablenumber" and it can be updated via "@update"
23
24 */
25
26 ; Create two empty tables
27 gi1 ftgen 0, 0, 1024, 2, 0
28 gi2 ftgen 0, 0, 512, 2, 0
29
30 chn_k "plot1", "w"
31 chn_k "plot2", "w"
32
33 instr 1
34 ktab1 init gi1
35 ktab2 init gi2
36
37 ; switch tables every five seconds
38 if metro(1/2) == 1 then
39 ktab1, ktab2 = ktab2, ktab1
40 endif
41
42 ; Modify the tables
43 ilen = ftlen(gi1)
44
45 ; We fill a table with an aplitude varying sine wave at k-rate
46 kamp = linlin(oscil:k(1, 0.1), 1, 8, -1, 1)
47 kval oscil kamp, 15
48 kidx = timeinstk() % ilen
49 tablew kval, kidx, gi1
50
51 ; The second table is filled with realtime audio input
52 aidx phasor sr/ftlen(gi2)
53 tablew inch(1)*2, aidx, gi2, 1
54
55 ; Update rate of the plots. NB: the widget update rate in
56 ; CsoundQt is limited to 30 fps, so any update faster than
57 ; than will have no effect other than time aliasing
58 ktrig metro 24
59
60 chnset ktrig == 1 ? -1 : ktab1, "plot1"
61 chnset ktrig == 1 ? -1 : ktab2, "plot2"
62
63 endin
64
65 schedule 1, 0.1, 3600, gi1, gi2
66
67 </CsInstruments>
68 <CsScore>
69
70 </CsScore>
71 </CsoundSynthesizer>
72
73
74
75
76 <bsbPanel>
77 <label>Widgets</label>
78 <objectName/>
79 <x>0</x>
80 <y>0</y>
81 <width>435</width>
82 <height>149</height>
83 <visible>true</visible>
84 <uuid/>
85 <bgcolor mode="background">
86 <r>240</r>
87 <g>240</g>
88 <b>240</b>
89 </bgcolor>
90 <bsbObject version="2" type="BSBTableDisplay">
91 <objectName>plot2</objectName>
92 <x>370</x>
93 <y>74</y>
94 <width>360</width>
95 <height>220</height>
96 <uuid>{0c6062cd-26ee-44ec-8b8c-2e57adfd1916}</uuid>
97 <visible>true</visible>
98 <midichan>0</midichan>
99 <midicc>-3</midicc>
100 <description/>
101 <color>
102 <r>255</r>
103 <g>193</g>
104 <b>3</b>
105 </color>
106 <range>0.00</range>
107 </bsbObject>
108 <bsbObject version="2" type="BSBTableDisplay">
109 <objectName>plot1</objectName>
110 <x>8</x>
111 <y>74</y>
112 <width>360</width>
113 <height>220</height>
114 <uuid>{de99af7a-d3d5-4e8f-a18a-86c66ec2481b}</uuid>
115 <visible>true</visible>
116 <midichan>0</midichan>
117 <midicc>-3</midicc>
118 <description/>
119 <color>
120 <r>255</r>
121 <g>153</g>
122 <b>0</b>
123 </color>
124 <range>0.00</range>
125 </bsbObject>
126 <bsbObject version="2" type="BSBLabel">
127 <objectName/>
128 <x>7</x>
129 <y>11</y>
130 <width>271</width>
131 <height>56</height>
132 <uuid>{cb8cacc9-7f4f-4465-af4f-b8c31fca1acb}</uuid>
133 <visible>true</visible>
134 <midichan>0</midichan>
135 <midicc>-3</midicc>
136 <description/>
137 <label>Table Plot Widget</label>
138 <alignment>center</alignment>
139 <valignment>top</valignment>
140 <font>Arial</font>
141 <fontsize>36</fontsize>
142 <precision>3</precision>
143 <color>
144 <r>67</r>
145 <g>67</g>
146 <b>67</b>
147 </color>
148 <bgcolor mode="nobackground">
149 <r>255</r>
150 <g>255</g>
151 <b>255</b>
152 </bgcolor>
153 <bordermode>false</bordermode>
154 <borderradius>1</borderradius>
155 <borderwidth>0</borderwidth>
156 </bsbObject>
157 <bsbObject version="2" type="BSBLabel">
158 <objectName/>
159 <x>10</x>
160 <y>360</y>
161 <width>460</width>
162 <height>127</height>
163 <uuid>{ce9539a1-5f6f-4a93-8e67-2e45899088cb}</uuid>
164 <visible>true</visible>
165 <midichan>0</midichan>
166 <midicc>-3</midicc>
167 <description/>
168 <label>This widget allows to visualize the contents of a table in real-time. To set the table number to plot send the table number to its channel. To update the plot just send -1 and the last set table will be updated.
169
170 The widget also accepts string values. The table can be set with 'outvalue "@set &lt;tablenumber>"' and it can be updated via 'outvalue "@update"'
171 </label>
172 <alignment>left</alignment>
173 <valignment>top</valignment>
174 <font>Liberation Sans</font>
175 <fontsize>12</fontsize>
176 <precision>3</precision>
177 <color>
178 <r>52</r>
179 <g>52</g>
180 <b>52</b>
181 </color>
182 <bgcolor mode="nobackground">
183 <r>68</r>
184 <g>68</g>
185 <b>68</b>
186 </bgcolor>
187 <bordermode>false</bordermode>
188 <borderradius>3</borderradius>
189 <borderwidth>0</borderwidth>
190 </bsbObject>
191 <bsbObject version="2" type="BSBLabel">
192 <objectName/>
193 <x>11</x>
194 <y>320</y>
195 <width>121</width>
196 <height>38</height>
197 <uuid>{c9cdfd2b-7f5d-48bf-91c5-c6172252fdc4}</uuid>
198 <visible>true</visible>
199 <midichan>0</midichan>
200 <midicc>-3</midicc>
201 <description/>
202 <label>Description</label>
203 <alignment>left</alignment>
204 <valignment>top</valignment>
205 <font>Liberation Sans</font>
206 <fontsize>20</fontsize>
207 <precision>3</precision>
208 <color>
209 <r>67</r>
210 <g>67</g>
211 <b>67</b>
212 </color>
213 <bgcolor mode="nobackground">
214 <r>255</r>
215 <g>255</g>
216 <b>255</b>
217 </bgcolor>
218 <bordermode>false</bordermode>
219 <borderradius>1</borderradius>
220 <borderwidth>0</borderwidth>
221 </bsbObject>
222 </bsbPanel>
223 <bsbPresets>
224 </bsbPresets>