summaryrefslogtreecommitdiff
path: root/examples-xml/randomi.csd.xml
blob: 44c967e137041f6593b7bc4ce29b27cfcf0b6d3f (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
44
45
46
47
48
<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 randomi.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> 4410
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 10
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1

     <emphasis role="ohdr">seed</emphasis> 0
     
<emphasis role="comment">; Instrument #1.</emphasis>
<emphasis role="oblock">instr</emphasis> 1
  <emphasis role="comment">; Choose a random frequency between 220 and 440.</emphasis>
  <emphasis role="comment">; Generate new random numbers at 10 Hz.</emphasis>
  kmin    <emphasis role="opc">init</emphasis> 220
  kmax    <emphasis role="opc">init</emphasis> 440
  kcps    <emphasis role="opc">init</emphasis> 10
  imode   <emphasis role="op">=</emphasis>    p4
  ifstval <emphasis role="op">=</emphasis>    p5
  
     <emphasis role="opc">printf_i</emphasis> "\nMode<emphasis role="op">:</emphasis> <emphasis role="op">%</emphasis>d\n", 1, imode
  k1 <emphasis role="opc">randomi</emphasis> kmin, kmax, kcps, imode, ifstval
     <emphasis role="opc">printks</emphasis> "k1 <emphasis role="op">=</emphasis> <emphasis role="op">%</emphasis>f\n", 0.1, k1
<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 one second.</emphasis>
<emphasis role="comment">; each time with a different mode.</emphasis>
<emphasis role="stamnt">i</emphasis> 1 0 1
<emphasis role="stamnt">i</emphasis> 1 1 1 1
<emphasis role="stamnt">i</emphasis> 1 2 1 2 330
<emphasis role="stamnt">i</emphasis> 1 3 1 3
<emphasis role="stamnt">e</emphasis>

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