summaryrefslogtreecommitdiff
path: root/examples-xml/printk2.csd.xml
blob: d7b780a54e1d9ea18977f107aa0f589e2f364248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<programlisting>
<emphasis role="csdtag">&lt;CsoundSynthesizer&gt;</emphasis>
<emphasis role="csdtag">&lt;CsOptions&gt;</emphasis>
<emphasis role="comment">; Select audio/midi flags here according to platform</emphasis>
<emphasis role="comment">; Audio out   Audio in</emphasis>
-odac           -iadc    <emphasis role="comment">;;;RT audio I/O</emphasis>
<emphasis role="comment">; For Non-realtime ouput leave only the line below:</emphasis>
<emphasis role="comment">; -o printk2.wav -W ;;; for file output any platform</emphasis>
<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>

<emphasis role="comment">; Initialize the global variables.</emphasis>
<emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100
<emphasis role="ohdr">kr</emphasis> <emphasis role="op">=</emphasis> 44100
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 1
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1

<emphasis role="comment">; Instrument #1.</emphasis>
<emphasis role="oblock">instr</emphasis> 1
  <emphasis role="comment">; Change a value linearly from 0 to 10,</emphasis>
  <emphasis role="comment">; over the period defined by p3.</emphasis>
  kval1 <emphasis role="opc">line</emphasis> 0, p3, 10

  <emphasis role="comment">; If kval1 is greater than or equal to 5, </emphasis>
  <emphasis role="comment">; then kval=2, else kval=1.</emphasis>
  kval2 <emphasis role="op">=</emphasis> (kval1 <emphasis role="op">>=</emphasis> 5 <emphasis role="op">?</emphasis> 2 <emphasis role="op">:</emphasis> 1)

  <emphasis role="comment">; Print the value of kval2 when it changes.</emphasis>
  <emphasis role="opc">printk2</emphasis> kval2
<emphasis role="oblock">endin</emphasis>


<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>

<emphasis role="comment">; Play Instrument #1 for 5 seconds.</emphasis>
<emphasis role="stamnt">i</emphasis> 1 0 5
<emphasis role="stamnt">e</emphasis>


<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
</programlisting>