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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
|
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; IRIX 6.3 IP32) [Netscape]">
<TITLE>Tutorial 3 - Building CECILIA modules</TITLE>
</HEAD>
<BODY>
<CENTER> </CENTER>
<CENTER><TABLE COLS=3 WIDTH="100%" NOSAVE >
<TR ALIGN=CENTER VALIGN=CENTER NOSAVE>
<TD ALIGN=LEFT VALIGN=TOP NOSAVE><B><A HREF="tut2.html"><--</A></B></TD>
<TD ALIGN=CENTER VALIGN=CENTER NOSAVE><A HREF="index.html"><IMG SRC="help.gif" ></A></TD>
<TD ALIGN=RIGHT VALIGN=TOP NOSAVE><B><FONT COLOR="#000000"><A HREF="soundwin.html">--></A></FONT></B></TD>
</TR>
</TABLE></CENTER>
<CENTER>
<H2>
<B>TUTORIAL 3 : BUILDING CECILIA MODULES</B></H2></CENTER>
<CENTER><A HREF="#Getting ready">Building a simple CECILIA sound-processing
module</A></CENTER>
<CENTER><A HREF="#Building the interface">Buliding the interface</A></CENTER>
<CENTER><A HREF="#Opening">Making the orchestra and score</A></CENTER>
<CENTER> </CENTER>
<CENTER>
<HR></CENTER>
<UL>
<LI>
<A NAME="Getting ready"></A><B>Building a simple CECILIA sound-processing
module. <FONT SIZE=-2><A HREF="#">top</A></FONT></B></LI>
<P>This tutorial assumes that the user is familiar with Csound programming.
<P>We will build a small module for filtering sounds. This module will
feature a choice of low-pass, hi-pass, bandpass and band-reject filter,
along with a time-function to control the cut-off and/or center frequency.
We will also offer a post filter gain slider, a selector for choosing the
soundfile to process and an automatic balance switch to reestablish power
to the filtered sound.
<P>Normally, we would first build the orchestra in Csound and then add
the interface, but since we already know what we want to do, we will first
build the interface.</UL>
<HR WIDTH="100%">
<UL>
<LI>
<A NAME="Building the interface"></A><B>Building the interface. <FONT SIZE=-2><A HREF="#">top</A></FONT></B></LI>
<P>We will therefor need to define the following interface objects:
<BR>
<OL>
<LI>
a <A HREF="cec_file.html">selector</A> to choose to sound to be processed</LI>
<LI>
a <A HREF="cec_grap.html">graph</A> for the time varying cut-off frequency
of the filter.</LI>
<LI>
a <A HREF="cec_grap.html">graph</A> for the bandwidth of the filter (for
band-pass and band-reject variants).</LI>
<LI>
a <A HREF="cec_popu.html">popup</A> to select the type of filtering.</LI>
<LI>
a <A HREF="cec_rsli.html">slider</A> for the output gain.</LI>
<LI>
a <A HREF="cec_togg.html">toggle</A> for reesetablishing the level of the
sound.</LI>
<BR> </OL>
We will be using Csound's <A HREF="../csman/Modifier/butterhp.html">Butterworth</A>
filters to do the filtering. To control the switching between different
kinds of filtering, we will use Csound's <A HREF="../csman/Syntax/igoto.html"><B>if
</B>/<B> goto</B></A><B> </B>structure.
<BR>
<UL>
<LI>
Under the <B>File</B> menu in the Main window, select <B>New...</B> and
then <B>Module...</B></LI>
<BR>
<LI>
Open the <B>tk_interface </B>editor pane by clicking on its button or choosing
it in the <B>Sections</B> menu.</LI>
<BR>
<LI>
Enter the first graph definition by typing this line:</LI>
<PRE><TT>cgraph freqc -unit Hz -label "Cut-off Frequency" -rel log -min 50 -max 20000 -init 2500</TT></PRE>
</UL>
<UL>
<LI>
Enter the second graph by doing Button-3 or Command-Click in the tk_interface
pane to bring up the inserter, Choose <B>graph freq </B>under the <B>Graphs</B>
cascade. The following pre-formatted line is inserted:</LI>
<PRE>cgraph freq -unit x -rel lo -min 20 -max 15000 -init 500</PRE>
But we will change the parameter range to -min .001, max 1 and init to
0.1 because this function will be used as a multiplier for the center frequency
(freqc) in the orchestra to give us the bandwidth of the filter. We also
change -rel log to -rel lin for a linear function. While we are here, let's
give it a label of "Bandwidth".</UL>
<UL>
<LI>
Enter the fileselector by using the same inserter method and choosing the
standard filein under <B>Filein.</B></LI>
<BR>
<LI>
Enter the toggle. Change the name to "select" and give the label "Balance
with Input".</LI>
<BR>
<LI>
Enter the slider with the inserter. Choose <B>slider10</B> under <B>Sliders.</B>
Change the name to "gain" and give a label "Post-Filter Gain". Change to
init value to 1.</LI>
<BR>
<LI>
Enter the popup with he inserter. Change the name to "type" , the label
to "Select Filter Type" and give this list for value: "lo-pass hi-pass
band-pass band-reject".</LI>
<BR> </UL>
The contents of the tk_interface pane should now read as:
<PRE>cfilein name -label "Sound to process"
cgraph freqc -label "Cut-off Frequency" -rel log -min 50 -max 20000 -init 2500
cgraph freq -label "Center Frequency" -rel lin -min .001 -max 1 -init 0.1
cslider data10 -label "Post-Filter Gain" -res .1 -min 0 -max 10 -init 1
ctoggle gain -label "Balance with Input" -init 0
cpopup type -label "Select Filter Type" -value "lo-pass hi-pass band-pass band-reject"</PRE>
Select <B>Save module as... </B>under the<B> File </B>menu, and give the
new module a name (TestFilters.cec is good). If all is well, the new module
will pop open with a grapher window and the Main window will enlarge to
include a file selector. CECILIA attempts to warn you on interface definition
errors. Check the interface carefully to make sure all the parameters and
objects are present and in the correct ranges.
<P>
<HR WIDTH="100%">
<BR>
<LI>
<A NAME="Opening"></A><B>Making the orchestra and the score. <FONT SIZE=-2><A HREF="#">top</A></FONT></B></LI>
<BR>
<UL>
<LI>
Open the stereo pane in the CECILIA editor.</LI>
<BR>
<LI>
Enter the following text in the pane:</LI>
</UL>
<UL><B><TT><FONT COLOR="#FF0000"> instr 1</FONT></TT></B>
<P><TT>a1,a2 <B><FONT COLOR="#000099">soundin</FONT></B> "[name]",
[offname] <B><FONT COLOR="#993399">; name from fileselector</FONT></B></TT>
<BR><B><TT><FONT COLOR="#993399">
; and offset substituted here</FONT></TT></B>
<P><TT>if gktype != 0 goto hp
<B><FONT COLOR="#993399">; using if / goto and the value</FONT></B></TT>
<BR><TT>ag <B><FONT COLOR="#000099">butterlp</FONT></B>
a1, gkfreqc <B><FONT COLOR="#993399">;
of the "type" popup to select</FONT></B></TT>
<BR><TT>ad <B><FONT COLOR="#000099">butterlp</FONT></B>
a2, gkfreqc <B><FONT COLOR="#993399">;
the correct kind of filter</FONT></B></TT>
<BR><TT>goto bal</TT>
<P><B><TT><FONT COLOR="#006600">hp:</FONT></TT></B>
<BR><TT>if gktype != 1 goto bp
<B><FONT COLOR="#993399">; the freqc graph controls the</FONT></B></TT>
<BR><TT>ag <B><FONT COLOR="#000099">butterhp</FONT></B>
a1, gkfreqc <FONT COLOR="#993399">;
<B>cut-off frequency</B></FONT></TT>
<BR><TT>ad <B><FONT COLOR="#000099">butterhp</FONT></B>
a2, gkfreqc</TT>
<BR><TT>goto bal</TT>
<P><B><TT><FONT COLOR="#006600">bp:</FONT></TT></B>
<BR><TT>if gktype != 2 goto br
<B><FONT COLOR="#993399">; the freq graph controls the</FONT></B></TT>
<BR><TT>ag <B><FONT COLOR="#000099">butterbp</FONT></B>
a1, gkfreqc, gkfreq*gkfreqc <B><FONT COLOR="#993399">;bandwidth</FONT></B></TT>
<BR><TT>ad <B><FONT COLOR="#000099">butterbp</FONT></B>
a2, gkfreqc, gkfreq*gkfreqc</TT>
<BR><TT>goto bal</TT>
<P><B><TT><FONT COLOR="#006600">br:</FONT></TT></B>
<BR><TT>ag <B><FONT COLOR="#000099">butterbr
</FONT></B>a1, gkfreqc, gkfreq*gkfreqc</TT>
<BR><TT>ad <B><FONT COLOR="#000099">butterbr
</FONT></B>a2, gkfreqc, gkfreq*gkfreqc</TT>
<P><B><TT><FONT COLOR="#006600">bal:</FONT></TT></B>
<BR><TT>if gkgain == 0 goto nobal
<B><FONT COLOR="#993399">; gkgain toggle decides to</FONT></B></TT>
<BR><TT>ag <B><FONT COLOR="#000099">balance
</FONT></B>ag, a1
<B><FONT COLOR="#993399">; balance or not</FONT></B></TT>
<BR><TT>ad <B><FONT COLOR="#000099">balance
</FONT></B>ad, a2</TT>
<P><B><TT><FONT COLOR="#006600">nobal:</FONT></TT></B>
<BR><TT><B><FONT COLOR="#000099">outs</FONT></B> ag*gkdata10, ag*gkdata10
<B><FONT COLOR="#993399">; the data10 slider controls</FONT></B></TT>
<BR><B><TT><FONT COLOR="#993399">
; the final gain</FONT></TT></B>
<P><B><TT><FONT COLOR="#FF0000"> endin</FONT></TT></B></UL>
<BR>
<UL>
<LI>
Enter the score in the score editor pane. In fact, the only score that
we will need here is the <B>#min</B> keyword. Since the only note we want
is on instrument 1 and we do not need to pass it any parameter. The duration
of the note will always be the duration of the soundfile. This is a case
where the #min score is perfect. Make sure you study the other <A HREF="score.html">types
of scores </A>available in CECILIA. Studying the BuiltIn CECILIA
modules is a good way to develop an understanding for the powerful possibilities
of CECILIA score pre-processing.</LI>
<BR>
<LI>
Save the module, choose a sound with the file selector, define time-profiles
with the graphs and press <B>Play</B>!</LI>
<BR>
<LI>
Studying CECILIA's Builtin modules is highly recommended!</LI>
<BR> </UL>
</UL>
<HR WIDTH="100%">
<UL> </UL>
<UL> </UL>
</BODY>
</HTML>
|