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
|
<HTML>
<TITLE>ENVELOPES</TITLE>
<CENTER><P><A NAME="Envelopes"></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="./pftut.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./chorus.html">Next</A>
<HR></P></CENTER>
<H2>Toot 3: Envelopes</H2>
<P>Although in the second instrument we could control and vary the overall
amplitude from note to note, it would be more musical if we could contour
the loudness during the course of each note. To do this we'll need to employ
an additional unit generator <B><A HREF="./../Modifier/linen.html">linen</A></B>,
which the Csound reference manual defines as follows:</P>
<PRE><TT> kr <B>linen</B> kamp, irise, idur, idec
ar <B>linen</B> xamp, irise, idur, idec</TT>
</PRE>
<P><B>linen</B> is a signal modifier, capable of computing its output at
either control or audio rates. Since we plan to use it to modify the amplitude
envelope of the oscillator, we'll choose the latter version. Three of linen's
arguments expect <B>i</B>-rate variables. The fourth expects in one instance
a <B>k</B>-rate variable (or anything slower), and in the other an x-variable
(meaning a-rate or anything slower). Our <B><A HREF="./../Modifier/linen.html">linen</A></B>
we will get its amp from p4. </P>
<P>The output of the <B>linen</B> (k1) is patched into the kamp argument
of an <B><A HREF="./../Generate/oscil.html">oscil</A></B>. This applies an
envelope to the <B>oscil</B>. The orchestra and score files now appear
as: </P>
<PRE><TT> instr 3
k1 linen p4, p6, p3, p7 ; p4=amp
a1 oscil k1, p5, 1 ; p5=freq
out a1 ; p6=attack time
endin ; p7=release time
f1 0 4096 10 1 ; sine wave
;instr start duration amp(p4) freq(p5) attack(p6) release(p7)
i3 0 1 10000 440 .05 .7
i3 1.5 1 10000 440 .9 .1
i3 3 1 5000 880 .02 .99
i3 4.5 1 5000 880 .7 .01
i3 6 2 20000 220 .5 .5
e</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="./pftut.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./chorus.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>
|