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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<HTML>
<TITLE>TABLES_AND_LABELS</TITLE>
<CENTER><P><A NAME="Tables_and_Labels"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./TUTORIALS.html">Top of this section</A></B> - <A HREF="./carry.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./specfus.html">Next</A>
<HR></P></CENTER>
<H2>Toot 12: Tables and Labels</H2>
<P>This is by far our most complex instrument. In it we have designed the
ability to store pitches in a table and then index them in three different
ways: 1) directly, 2) via an lfo, and 3) randomly. As a means of switching
between these three methods, we will use Csound's <I><A HREF="./../Syntax/igoto.html">program
control </A></I>statements and <I><A HREF="./../Syntax/arith.html">logical
</A></I>and <I><A HREF="./../Syntax/cond.html">conditional</A>
</I>operations.</P>
<PRE><TT> instr 12
iseed = p8
iamp = ampdb(p4)
kdirect = p5
imeth = p6
ilforate = p7 ; lfo and random index rate
itab = 2
itablesize = 8
if (imeth == 1) igoto direct
if (imeth == 2) kgoto lfo
if (imeth == 3) kgoto random
direct: kpitch table kdirect, itab ; index "f2" via p5
kgoto contin
lfo: kindex phasor ilforate
kpitch table kindex * itablesize, itab
kgoto contin
random: kindex randh int(7), ilforate, iseed
kpitch table abs(kindex), itab
contin: kamp linseg 0, p3 * .1, iamp, p3 * .9, 0 ; amp envelope
asig oscil kamp, cpspch(kpitch), 1 ; audio osc
out asig
endin
f1 0 2048 10 1 ; Sine
f2 0 8 -2 8.00 8.02 8.04 8.05 8.07 8.09 8.11 9.00 ; cpspch C major scale
; method 1 - direct index of table values
; ins start dur amp index method lforate rndseed
i12 0 .5 86 7 1 0 0
i12 .5 .5 86 6 1 0
i12 1 .5 86 5 1 0
i12 1.5 .5 86 4 1 0
i12 2 .5 86 3 1 0
i12 2.5 .5 86 2 1 0
i12 3 .5 86 1 1 0
i12 3.5 .5 86 0 1 0
i12 4 .5 86 0 1 0
i12 4.5 .5 86 2 1 0
i12 5 .5 86 4 1 0
i12 5.5 2.5 86 7 1 0
s
; method 2 - lfo index of table values
; ins start dur amp index method lforate rndseed
i12 0 2 86 0 2 1 0
i12 3 2 86 0 2 2
i12 6 2 86 0 2 4
i12 9 2 86 0 2 8
i12 12 2 86 0 2 16
s
; method 3 - random index of table values
; ins start dur amp index method rndrate rndseed
i12 0 2 86 0 3 2 .1
i12 3 2 86 0 3 3 .2
i12 6 2 86 0 3 4 .3
i12 9 2 86 0 3 7 .4
i12 12 2 86 0 3 11 .5
i12 15 2 86 0 3 18 .6
i12 18 2 86 0 3 29 .7
i12 21 2 86 0 3 47 .8
i12 24 2 86 0 3 76 .9
i12 27 2 86 0 3 123 .9
i12 30 5 86 0 3 199 .1</TT>
</PRE>
<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./TUTORIALS.html">Top of this section</A></B> - <A HREF="./carry.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./specfus.html">Next</A>
<HR></P></CENTER>
<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>©
Jean Piché & Peter J. Nix, 1994-97</FONT></FONT></I></B>
</CENTER>
</HTML>
|