summaryrefslogtreecommitdiff
path: root/examples-xml/scalearray.csd.xml
diff options
context:
space:
mode:
Diffstat (limited to 'examples-xml/scalearray.csd.xml')
-rw-r--r--examples-xml/scalearray.csd.xml40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples-xml/scalearray.csd.xml b/examples-xml/scalearray.csd.xml
new file mode 100644
index 0000000..4252b2d
--- /dev/null
+++ b/examples-xml/scalearray.csd.xml
@@ -0,0 +1,40 @@
+<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>
+-n
+<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
+<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>
+<emphasis role="comment">;example by joachim heintz</emphasis>
+
+ <emphasis role="ohdr">seed</emphasis> 0
+
+<emphasis role="oblock">instr</emphasis> 1
+<emphasis role="comment">;create an array with 10 elements</emphasis>
+kArr[] <emphasis role="opc">init</emphasis> 10
+<emphasis role="comment">;fill in random numbers and print them out</emphasis>
+ <emphasis role="opc">printks</emphasis> "kArr <emphasis role="opc">in</emphasis> maximum range 0..100<emphasis role="op">:</emphasis>\n", 0
+kIndx <emphasis role="op">=</emphasis> 0
+ until kIndx <emphasis role="op">==</emphasis> 10 do
+kNum <emphasis role="opc">random</emphasis> 0, 100
+kArr[kIndx] <emphasis role="op">=</emphasis> kNum
+ <emphasis role="opc">printf</emphasis> "kArr[<emphasis role="op">%</emphasis>d] <emphasis role="op">=</emphasis> <emphasis role="op">%</emphasis>10f\n", kIndx<emphasis role="op">+</emphasis>1, kIndx, kNum
+kIndx <emphasis role="op">+</emphasis><emphasis role="op">=</emphasis> 1
+ od
+<emphasis role="comment">;scale numbers 0...1 and print them out again</emphasis>
+ <emphasis role="opc">scalearray</emphasis> kArr, 0, 1
+kIndx <emphasis role="op">=</emphasis> 0
+ <emphasis role="opc">printks</emphasis> "kArr <emphasis role="opc">in</emphasis> range 0..1\n", 0
+ until kIndx <emphasis role="op">==</emphasis> 10 do
+ <emphasis role="opc">printf</emphasis> "kArr[<emphasis role="op">%</emphasis>d] <emphasis role="op">=</emphasis> <emphasis role="op">%</emphasis>10f\n", kIndx<emphasis role="op">+</emphasis>1, kIndx, kArr[kIndx]
+kIndx <emphasis role="op">+</emphasis><emphasis role="op">=</emphasis> 1
+ od
+ <emphasis role="opc">turnoff</emphasis>
+<emphasis role="oblock">endin</emphasis>
+<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
+<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>
+<emphasis role="stamnt">i</emphasis>1 0 0.1
+<emphasis role="stamnt">e</emphasis>
+<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
+<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
+</programlisting> \ No newline at end of file