| 1 |
/* Getting started.. 1.1 Hello World |
| 2 |
|
| 3 |
The 'Basics Chapter' of the Tutorials, will explain the root functionality of CsoundQt. |
| 4 |
You will find the descriptions as comments directly in the code. |
| 5 |
|
| 6 |
This first example is focused on the different comment-types and shows a simple program, which outputs a "Hello World - 440Hz beep" to the computer's audio output and the "Hello World" string to the console. |
| 7 |
|
| 8 |
To start it, press the RUN Button in the CsoundQt-toolbar, or choose "Control->Run Csound" from the menu. |
| 9 |
*/ |
| 10 |
|
| 11 |
<CsoundSynthesizer> |
| 12 |
<CsOptions> |
| 13 |
</CsOptions> |
| 14 |
<CsInstruments> |
| 15 |
ksmps=32 |
| 16 |
; This is a comment! |
| 17 |
; Comments describe how things are done, and help to explain the code. |
| 18 |
; They are shown in green in CsoundQt. |
| 19 |
; Anything after a semicolon will be ignored by Csound, so you can use it for human readable information. |
| 20 |
|
| 21 |
/* |
| 22 |
If you need more space than one line, |
| 23 |
it's |
| 24 |
no |
| 25 |
problem, with those comment signs used here. |
| 26 |
*/ |
| 27 |
|
| 28 |
instr 123 ; instr starts an instrument block and refers it to a number. In this case, it is 123. |
| 29 |
; You can put comments everywhere, they will not become compiled. |
| 30 |
prints "Hello World!%n" ; 'prints' will print a string to the Csound console. |
| 31 |
aSin oscils 0dbfs/4, 440, 0 ; the opcode 'oscils' here generates a 440 Hz sinetone signal at -12dB FS |
| 32 |
out aSin ; here the signal is assigned to the computer audio output |
| 33 |
endin |
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
i 123 0 1 ; the instrument is called by its number (123) to be played |
| 38 |
e ; e - ends the score |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |
| 41 |
; written by Alex Hofmann (Nov. 2009) - Incontri HMT-Hannover |
| 42 |
<bsbPanel> |
| 43 |
<label>Widgets</label> |
| 44 |
<objectName/> |
| 45 |
<x>1013</x> |
| 46 |
<y>279</y> |
| 47 |
<width>563</width> |
| 48 |
<height>397</height> |
| 49 |
<visible>true</visible> |
| 50 |
<uuid/> |
| 51 |
<bgcolor mode="background"> |
| 52 |
<r>160</r> |
| 53 |
<g>158</g> |
| 54 |
<b>162</b> |
| 55 |
</bgcolor> |
| 56 |
<bsbObject version="2" type="BSBConsole"> |
| 57 |
<objectName/> |
| 58 |
<x>24</x> |
| 59 |
<y>2</y> |
| 60 |
<width>250</width> |
| 61 |
<height>158</height> |
| 62 |
<uuid>{1802f52a-87e1-4b4e-8d07-4995b2f04435}</uuid> |
| 63 |
<visible>true</visible> |
| 64 |
<midichan>0</midichan> |
| 65 |
<midicc>-3</midicc> |
| 66 |
<font>Courier</font> |
| 67 |
<fontsize>8</fontsize> |
| 68 |
<color> |
| 69 |
<r>0</r> |
| 70 |
<g>0</g> |
| 71 |
<b>0</b> |
| 72 |
</color> |
| 73 |
<bgcolor mode="nobackground"> |
| 74 |
<r>255</r> |
| 75 |
<g>255</g> |
| 76 |
<b>255</b> |
| 77 |
</bgcolor> |
| 78 |
</bsbObject> |
| 79 |
<bsbObject version="2" type="BSBLabel"> |
| 80 |
<objectName/> |
| 81 |
<x>25</x> |
| 82 |
<y>166</y> |
| 83 |
<width>249</width> |
| 84 |
<height>164</height> |
| 85 |
<uuid>{7f895e8a-7492-42e7-ac81-27023be7ff44}</uuid> |
| 86 |
<visible>true</visible> |
| 87 |
<midichan>0</midichan> |
| 88 |
<midicc>-3</midicc> |
| 89 |
<label>This is a widget window. In this case, the Console Output is also visible here. More information about widgets can be found in the menu: Examples-> Widgets</label> |
| 90 |
<alignment>left</alignment> |
| 91 |
<font>Lucida Grande</font> |
| 92 |
<fontsize>18</fontsize> |
| 93 |
<precision>3</precision> |
| 94 |
<color> |
| 95 |
<r>0</r> |
| 96 |
<g>0</g> |
| 97 |
<b>0</b> |
| 98 |
</color> |
| 99 |
<bgcolor mode="nobackground"> |
| 100 |
<r>255</r> |
| 101 |
<g>255</g> |
| 102 |
<b>255</b> |
| 103 |
</bgcolor> |
| 104 |
<bordermode>noborder</bordermode> |
| 105 |
<borderradius>1</borderradius> |
| 106 |
<borderwidth>1</borderwidth> |
| 107 |
</bsbObject> |
| 108 |
</bsbPanel> |
| 109 |
<bsbPresets> |
| 110 |
</bsbPresets> |