<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!--Converted with LaTeX2HTML 2008 (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> <TITLE>A Simple Example</TITLE> <META NAME="description" CONTENT="A Simple Example"> <META NAME="keywords" CONTENT="mma-tutorial"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="mma-tutorial.css"> <LINK REL="next" HREF="node4.html"> <LINK REL="previous" HREF="node2.html"> <LINK REL="up" HREF="mma-tutorial.html"> <LINK REL="next" HREF="node4.html"> </HEAD> <BODY bgcolor="#ffffff"> <DIV CLASS="navigation"><!--Navigation Panel--> <A NAME="tex2html64" HREF="node4.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html62" HREF="mma-tutorial.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html56" HREF="node2.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <BR> <B> Next:</B> <A NAME="tex2html65" HREF="node4.html">A More Complex Example</A> <B> Up:</B> <A NAME="tex2html63" HREF="mma-tutorial.html">Tutorial</A> <B> Previous:</B> <A NAME="tex2html57" HREF="node2.html">Installation</A> <BR> <BR></DIV> <!--End of Navigation Panel--> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A> <UL CLASS="ChildLinks"> <LI><A NAME="tex2html66" HREF="node3.html#SECTION00310000000000000000">Fella Bird, Basic Edition</A> <LI><A NAME="tex2html67" HREF="node3.html#SECTION00320000000000000000">Fella Bird, Improved Edition</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION00300000000000000000"> A Simple Example</A> </H1> <P> <H1><A NAME="SECTION00310000000000000000"> Fella Bird, Basic Edition</A> </H1> <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="#efefef" Border=3> <tr><td Align="CENTER" BGColor="White"> <SPAN CLASS="textbf"><BIG CLASS="XLARGE">Sheet Music for a Popular Song</BIG></SPAN> <A NAME="eg:birthday"></A> </tr> </td> <tr> <td > <IMG WIDTH="95%" SRC="mup/fella.png" ALT="Lost Image"> </td> </tr> </Table> <P> <P> This example piece of music is shown in a “fake book” or “lead sheet” style. It shows the melody notes, lyrics and chords. <P> As a first try at making a MIDI accompaniment file, we have created the following file: <P> <SPAN CLASS="textbf">// Sample tutorial file <BR>// Fella Bird, try 1 <BR> <BR> Tempo 120 <BR> Groove Rhumba <BR> <BR> 1 F <BR> 2 F <BR> 3 C7 <BR> 4 F <BR> 5 F <BR> 6 F <BR> 7 C7 <BR> 8 F <BR> 9 Gm <BR> 10 F <BR> 11 C7 <BR> 12 F <BR> 13 Gm <BR> 14 F <BR> 15 C7 <BR> 16 F / / z! <BR> <BR></SPAN> <P> After the comments in the file, the first line to note is: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Tempo 120 </B> </td></tr> </Table> <P> This sets the tempo, or speed, of the piece to 120 beats per minute. You may have to guess the tempo--very few pieces (especially in “fake book” style) will include a metronome setting. For slow pieces you might want to start with a tempo setting of “80”; for faster pieces, like swings, try around “150”; polkas and marches, which are really in <SPAN CLASS="textbf">2/2</SPAN> time, may require fast sounding tempos like “250”. Feel free to modify the tempo setting in the example files--you're not going to break anything. <P> Since we are using the standard library which was shipped with <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> , we can select one of the predefined grooves: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Groove Rhumba </B> </td></tr> </Table> <P> Note that this command also sets up the “time signature” to <SPAN CLASS="textbf">4/4</SPAN>. Not quite the same as the “cut” time indicated, but close enough. And speaking of “close enough”, we're using a rhumba rhythm instead of the merengue indicated in the score. <P> Finally, we have the chord information. The first bar (in the sheet music) indicates an “F” chord. So that's what we tell <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> to use: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>1 F </B> </td></tr> </Table> <P> We continue in a similar manner for the rest of the song. <P> We've simplifed the song a bit and show only one chord per bar. <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> automatically fills out the bars so that each has four chords. We could have entered the first bar as: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>2 F F F F </B> </td></tr> </Table> <P> or, more simply: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>2 F / / / </B> </td></tr> </Table> <P> and had the same result. But, who wants to do all that typing? <P> In the final bar, the last beat is a rest. <P> The line: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>16 F / / z! </B> </td></tr> </Table> <P> causes an “F” chord to be used on the first three beats, the fourth beat is completely silent due the to the “z!”. Note the difference between a “z” and “z!”--the first silences all but the drum track, the second silences everything. See the reference manual for more details on “z”. <P> Now, let's create our first MIDI file! If you are using the standard distribution, you should find a file “fella1.mma” in the tutorial directory. Change to this directory and type the command: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>mma fella1 </B> </td></tr> </Table> <P> Your computer should run the python script called “mma” and process the file “fella1.mma”. The MIDI file “fella1.mid” should be created. If this doesn't happen, please check your python installation, and make sure that you have installed “mma” where your shell can find it. If you are completely stuck, drop me an email. <P> Now, use your favorite MIDI file player to play the song. <P> How'd that sound? A piano doing some chords, a jazzy bass line, and a bit of drumming? Wonderful! <P> <H1><A NAME="SECTION00320000000000000000"> Fella Bird, Improved Edition</A> </H1> <P> If you play the MIDI created in the previous section you'll find a number of things lacking. Certainly: <P> <UL> <LI>It is hard to sing to because there is no aural indication of when to start, <P> </LI> <LI>The whole piece is the same volume, <P> </LI> <LI>It's a pretty short song, so let's play it twice. <P> </LI> </UL> <P> The following example has a number of improvements: <P> <SPAN CLASS="textbf"> // Sample tutorial file <BR>// Fella Bird, try 2 <BR> <BR> Tempo 120 <BR> Groove Metronome2-4 <BR> <BR> z * 2 <BR> <BR> Groove Rhumba <BR> Repeat <BR> Volume mp <BR> Cresc mf 4 <BR> <BR> 1 F <BR> 2 F <BR> 3 C7 <BR> 4 F <BR> 5 F <BR> 6 F <BR> 7 C7 <BR> 8 F <BR> 9 Gm <BR> 10 F <BR> 11 C7 <BR> <BR> Decresc p 4 <BR> <BR> 12 F <BR> 13 Gm <BR> 14 F <BR> 15 C7 <BR> <BR> RepeatEnding <BR> <BR> 16 F / / z <BR> <BR> RepeatEnd <BR> <BR> 17 F / / z! <BR> cut -1 <BR> <BR> <BR></SPAN> Try running <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> on this file and listen to it. Oh my, much better. <P> So, let's look at the changes. <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Groove Metronome2-4 </B> </td></tr> </Table> <P> This sets the current “groove” to a metronome. To find this groove <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> will automatically process the library file “metronome”. <P> The metronome groove consists of wood-blocks being struck in a <SPAN CLASS="textbf">4/4</SPAN> pattern. In order to “sound” the metronome, we need to create an empty bar: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B> z * 2 </B> </td></tr> </Table> <P> Mind you, we could have specified a chord here and gotten the same result (the groove has no definitions for any instruments other than the wood-block, so nothing else will sound). But, it seems to be more clear to use a “z”. <P> Okay, we lied. We didn't create an empty bar for the metronome. If you're sharp you'll notice that the “z” is followed by “* 2”. This means to play this bar two times. So, you get 2 bars of metronome. Cool. <P> We've not made any changes to the chords, but a few little changes do help this simple piece. Remember the dull, single volume? Well, have a look at the “volume” directives we've included in this version. We start the song off at a moderate volume, and increase it in several steps. And, at the end we use a “decresc” to reduce the volume to “quiet” over the final 4 bars. <P> Please refer to the <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> Reference Manual for salient details on the volume commands. <P> One minor change we did make in the chords is in bar 16. Note the change between this and bar 17. In the first we have a “z”, the second a “z!”. The difference between the two is that we want the precussion tracks to continue though the ending, but not on the final beat. <P> Finally, to ensure a complete cutoff in the final bar we have added a “cut” command. We're sure you'll find these minor changes a great improvement. <P> <P> <DIV CLASS="navigation"><HR> <!--Navigation Panel--> <A NAME="tex2html64" HREF="node4.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html62" HREF="mma-tutorial.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html56" HREF="node2.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <BR> <B> Next:</B> <A NAME="tex2html65" HREF="node4.html">A More Complex Example</A> <B> Up:</B> <A NAME="tex2html63" HREF="mma-tutorial.html">Tutorial</A> <B> Previous:</B> <A NAME="tex2html57" HREF="node2.html">Installation</A></DIV> <!--End of Navigation Panel--> <ADDRESS> bob 2010-11-07 </ADDRESS> </BODY> </HTML>