<!DOCTYPE html> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <TITLE>Using a wavetable as a sampler</TITLE> <META NAME="description" CONTENT="Using a wavetable as a sampler"> <META NAME="keywords" CONTENT="book"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="book.css"> <LINK REL="next" HREF="node36.html"> <LINK REL="previous" HREF="node34.html"> <LINK REL="up" HREF="node32.html"> <LINK REL="next" HREF="node36.html"> </HEAD> <BODY > <!--Navigation Panel--> <A ID="tex2html1064" HREF="node36.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A ID="tex2html1058" HREF="node32.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A ID="tex2html1052" HREF="node34.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A ID="tex2html1060" HREF="node4.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A ID="tex2html1062" HREF="node201.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A ID="tex2html1065" HREF="node36.html">Looping samplers</A> <B> Up:</B> <A ID="tex2html1059" HREF="node32.html">Examples</A> <B> Previous:</B> <A ID="tex2html1053" HREF="node34.html">Wavetable lookup in general</A> <B> <A ID="tex2html1061" HREF="node4.html">Contents</A></B> <B> <A ID="tex2html1063" HREF="node201.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H2><A ID="SECTION00663000000000000000"> Using a wavetable as a sampler</A> </H2> <P> Example B04.sampler.pd (Figure <A HREF="#fig02.14">2.14</A>) shows how to use a wavetable as a sampler. In this example the index into the sample (the wavetable) is controlled by mousing on a number box at top. A convenient scaling for the number box is hundredths of a second; to convert to samples (as the input of <TT>tabread4~</TT> requires) we multiply by 44100 samples/sec times 0.01 sec to get 441 samples per unit, before applying <TT>pack</TT> and <TT>line~</TT> in much the same way as they were used in the previous example. The transposition you hear depends on how quickly you mouse up and down. This example has introduced one new object class: <P> <DIV ALIGN="CENTER"><A ID="fig02.14"></A><A ID="2430"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.14:</STRONG> A sampler with mouse-controlled index: B04.sampler.pd.</CAPTION> <TR><TD><IMG WIDTH="336" HEIGHT="468" BORDER="0" SRC="img279.png" ALT="\begin{figure}\psfig{file=figs/fig02.14.ps}\end{figure}"></TD></TR> </TABLE> </DIV> <P> <BR><!-- MATH $\fbox{ $\mathrm{hip}\sim$\ }$ --> <IMG WIDTH="63" HEIGHT="41" ALIGN="MIDDLE" BORDER="0" SRC="img280.png" ALT="\fbox{ $\mathrm{hip}\sim$\ }">: <A ID="2558"></A>simple high-pass (low-cut) filter. The creation argument gives the roll-off frequency in cycles per second. We use it here to eliminate the constant (zero-frequency) output when the input sits in a single sample (whenever you aren't actively changing the wavetable reading location with the mouse). Filters are discussed in Chapter <A HREF="node127.html#chapter-filter">8</A>. <P> The <TT>pack</TT> and <TT>line~</TT> in this example are not included merely to make the sound more continuous, but are essential to making the sound intelligible at all. If the index into the wavetable lookup simply changed every time the mouse moved a pixel (say, twenty to fifty times a second) the overwhelming majority of samples would get the same index as the previous sample (the other 44000+ samples, not counting the ones where the mouse moved.) So the speed of precession would almost always be zero. Instead of changing transpositions, you would hear 20 to 50 cycles-per-second grit. (Try it to find out what that sounds like!) <P> <HR> <!--Navigation Panel--> <A ID="tex2html1064" HREF="node36.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A ID="tex2html1058" HREF="node32.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A ID="tex2html1052" HREF="node34.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A ID="tex2html1060" HREF="node4.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A ID="tex2html1062" HREF="node201.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A ID="tex2html1065" HREF="node36.html">Looping samplers</A> <B> Up:</B> <A ID="tex2html1059" HREF="node32.html">Examples</A> <B> Previous:</B> <A ID="tex2html1053" HREF="node34.html">Wavetable lookup in general</A> <B> <A ID="tex2html1061" HREF="node4.html">Contents</A></B> <B> <A ID="tex2html1063" HREF="node201.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Miller Puckette 2006-12-30 </ADDRESS> </BODY> </HTML>