2022-04-12 22:02:59 -03:00
|
|
|
<!DOCTYPE html>
|
2022-04-12 21:54:18 -03:00
|
|
|
|
|
|
|
<!--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>
|
2022-04-12 22:02:59 -03:00
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
|
2022-04-12 21:54:18 -03:00
|
|
|
<TITLE>MIDI-style synthesizer</TITLE>
|
|
|
|
<META NAME="description" CONTENT="MIDI-style synthesizer">
|
|
|
|
<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="previous" HREF="node55.html">
|
|
|
|
<LINK REL="up" HREF="node50.html">
|
|
|
|
<LINK REL="next" HREF="node57.html">
|
|
|
|
</HEAD>
|
|
|
|
|
|
|
|
<BODY >
|
|
|
|
<!--Navigation Panel-->
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1375"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node57.html">
|
|
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="next.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1369"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node50.html">
|
|
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="up.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1365"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node55.html">
|
|
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="prev.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1371"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node4.html">
|
|
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="contents.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1373"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node201.html">
|
|
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="index.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<BR>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Next:</B> <A ID="tex2html1376"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node57.html">Exercises</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Up:</B> <A ID="tex2html1370"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node50.html">Examples</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Previous:</B> <A ID="tex2html1366"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node55.html">Analog-style sequencer</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> <A ID="tex2html1372"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node4.html">Contents</A></B>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> <A ID="tex2html1374"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node201.html">Index</A></B>
|
|
|
|
<BR>
|
|
|
|
<BR>
|
|
|
|
<!--End of Navigation Panel-->
|
|
|
|
|
2022-04-12 23:32:40 -03:00
|
|
|
<H2><A ID="SECTION007106000000000000000">
|
2022-04-12 21:54:18 -03:00
|
|
|
MIDI-style synthesizer</A>
|
|
|
|
</H2>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Example C10.monophonic.synth.pd (Figure <A HREF="#fig03.16">3.16</A>) also implements a monophonic,
|
|
|
|
note-oriented synthesizer, but in this case oriented toward MIDI
|
|
|
|
controllability. Here the tasks of envelope generation and sequencing pitches
|
|
|
|
are handled using control streams instead of audio signals. New
|
|
|
|
control objects are needed for this example:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
2022-04-12 23:32:40 -03:00
|
|
|
<DIV ALIGN="CENTER"><A ID="fig03.16"></A><A ID="3787"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<TABLE>
|
|
|
|
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 3.16:</STRONG>
|
|
|
|
A MIDI-style monophonic synthesizer.</CAPTION>
|
|
|
|
<TR><TD><IMG
|
|
|
|
WIDTH="496" HEIGHT="459" BORDER="0"
|
|
|
|
SRC="img351.png"
|
|
|
|
ALT="\begin{figure}\psfig{file=figs/fig03.16.ps}\end{figure}"></TD></TR>
|
|
|
|
</TABLE>
|
|
|
|
</DIV>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{ $\mathrm{notein}$}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="62" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img352.png"
|
|
|
|
ALT="\fbox{ $\mathrm{notein}$}">:
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="3851"></A>MIDI note input. Three outlets give the pitch, velocity, and channel of
|
2022-04-12 21:54:18 -03:00
|
|
|
incoming MIDI note-on and note-off events (with note-off events appearing as
|
|
|
|
velocity-zero note-on events). The outputs appear in Pd's customary
|
|
|
|
right-to-left order.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{ $\mathrm{stripnote}$}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="81" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img353.png"
|
|
|
|
ALT="\fbox{ $\mathrm{stripnote}$}">:
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="3852"></A>filter out note-off messages. This passes
|
2022-04-12 21:54:18 -03:00
|
|
|
(pitch, velocity) pairs through whenever the velocity is nonzero, dropping
|
|
|
|
the others. Unlike <TT>notein</TT>, <TT>stripnote</TT> does not
|
|
|
|
directly use hardware MIDI input or output.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{ $\mathrm{trigger}$}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="65" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img354.png"
|
|
|
|
ALT="\fbox{ $\mathrm{trigger}$}">,
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{ $\mathrm{t}$}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="25" HEIGHT="39" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img355.png"
|
|
|
|
ALT="\fbox{ $\mathrm{t}$}">:
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="3853"></A>copy a message to outlets in right to left order, with type conversion. The
|
2022-04-12 23:17:03 -03:00
|
|
|
creation arguments ("b" and "f" in this example) specify two outlets, one
|
|
|
|
giving "bang" messages, the other "float" (i.e., numbers). One outlet
|
2022-04-12 21:54:18 -03:00
|
|
|
is created for each creation argument. The outputs appear in Pd's standard
|
|
|
|
right-to-left order.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The patch's control objects feed frequencies to the <TT>phasor~</TT> object
|
|
|
|
whenever a MIDI note-on message is received. Controlling the amplitude (via
|
|
|
|
the <TT>line~</TT> object) is more difficult. When a note-on message is
|
|
|
|
received, the <TT>sel 0</TT> object outputs the velocity at right (because
|
|
|
|
the input failed to match 0); this is divided by the maximum MIDI velocity of
|
|
|
|
127 and packed into a message for <TT>line~</TT> with a time of 100 msec.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
However, when a note-off is received, it is only appropriate to stop the sound
|
|
|
|
if the note-off pitch actually matches the pitch the instrument is playing.
|
2022-04-12 23:17:03 -03:00
|
|
|
For example, suppose the messages received are "60 127", "72 127",
|
|
|
|
"60 0", and "72 0". When the note-on at pitch 72 arrives the pitch should
|
|
|
|
change to 72, and then the "60 0" message should be ignored, with the note
|
|
|
|
playing until the "72 0" message.
|
2022-04-12 21:54:18 -03:00
|
|
|
|
|
|
|
<P>
|
|
|
|
To accomplish this, first we store the velocity in the upper <TT>float</TT> object. Second, when the pitch arrives, it too is stored (the lower
|
|
|
|
<TT>float</TT> object) and then the velocity is tested against zero (the
|
2022-04-12 23:17:03 -03:00
|
|
|
"bang" outlet of <TT>t b f</TT> recalls the velocity which is sent to
|
2022-04-12 21:54:18 -03:00
|
|
|
<TT>sel 0</TT>). If this is zero, the second step is to recall the pitch and
|
|
|
|
test it (the <TT>select</TT> object) against the most recently received
|
2022-04-12 23:17:03 -03:00
|
|
|
note-on pitch. Only if these are equal (so that "bang" appears at the
|
|
|
|
left-hand-side outlet of <TT>select</TT>) does the message "0 1000" go to the
|
2022-04-12 21:54:18 -03:00
|
|
|
<TT>line~</TT> object.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<!--Navigation Panel-->
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1375"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node57.html">
|
|
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="next.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1369"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node50.html">
|
|
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="up.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1365"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node55.html">
|
|
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="prev.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1371"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node4.html">
|
|
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="contents.png"></A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<A ID="tex2html1373"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node201.html">
|
|
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="index.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<BR>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Next:</B> <A ID="tex2html1376"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node57.html">Exercises</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Up:</B> <A ID="tex2html1370"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node50.html">Examples</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> Previous:</B> <A ID="tex2html1366"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node55.html">Analog-style sequencer</A>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> <A ID="tex2html1372"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node4.html">Contents</A></B>
|
2022-04-12 23:32:40 -03:00
|
|
|
<B> <A ID="tex2html1374"
|
2022-04-12 21:54:18 -03:00
|
|
|
HREF="node201.html">Index</A></B>
|
|
|
|
<!--End of Navigation Panel-->
|
|
|
|
<ADDRESS>
|
|
|
|
Miller Puckette
|
|
|
|
2006-12-30
|
|
|
|
</ADDRESS>
|
|
|
|
</BODY>
|
|
|
|
</HTML>
|