<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--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>
<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 NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<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">
<!--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>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<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>
 
		<BR>
		<TABLE CELLSPACING=0 Align="Center" CELLPADDING=10 BGCOLOR="#efefef" BORDER=3>
		<TR> <TD ALIGN="CENTER" BGCOLOR="White">
	    	<B><FONT SIZE="+2">Sheet Music for a Popular Song</FONT></B>    <A NAME="eg:birthday"></A>	
	 	</TR></TD> <TR><TD Align="Center">
		
    <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>
<B>//&nbsp;Sample&nbsp;tutorial&nbsp;file
<BR>//&nbsp;Fella&nbsp;Bird,&nbsp;try&nbsp;1
<BR>&nbsp;
<BR>
Tempo&nbsp;120
<BR>
Groove&nbsp;Rhumba
<BR>&nbsp;
<BR>
1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gm
<BR>
10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gm
<BR>
14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F&nbsp;&nbsp;/&nbsp;&nbsp;/&nbsp;z!
<BR>&nbsp;
<BR></B>

<P>
After the comments in the file, the first line to note is:

<P>

      <TABLE ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>Tempo 120 </B></BLOCKQUOTE>
   
	</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 <B>2/2</B> 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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>Groove Rhumba </B></BLOCKQUOTE>
   
	</TD></TR></TABLE>

<P>
Note that this command also sets up the ``time signature'' to <B>4/4</B>.
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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>1 F </B></BLOCKQUOTE>
   
	</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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>2 F F F F </B></BLOCKQUOTE>
   
	</TD></TR></TABLE>

<P>
or, more simply:

<P>

      <TABLE ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>2 F / / / </B></BLOCKQUOTE>
   
	</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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>16  F / / z! </B></BLOCKQUOTE>
   
	</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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>mma fella1 </B></BLOCKQUOTE>
   
	</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>
<B> //&nbsp;Sample&nbsp;tutorial&nbsp;file
<BR>//&nbsp;Fella&nbsp;Bird,&nbsp;try&nbsp;2
<BR>&nbsp;
<BR>
Tempo&nbsp;120
<BR>
Groove&nbsp;Metronome2-4
<BR>&nbsp;
<BR>
z&nbsp;*&nbsp;2
<BR>&nbsp;
<BR>
Groove&nbsp;Rhumba
<BR>
Repeat
<BR>
Volume&nbsp;mp
<BR>
Cresc&nbsp;mf&nbsp;4
<BR>&nbsp;
<BR>
1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>
8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gm
<BR>
10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>&nbsp;
<BR>
Decresc&nbsp;p&nbsp;4
<BR>&nbsp;
<BR>
12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gm
<BR>
14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F
<BR>
15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C7
<BR>&nbsp;
<BR>
RepeatEnding
<BR>&nbsp;
<BR>
16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F&nbsp;&nbsp;/&nbsp;&nbsp;/&nbsp;z
<BR>&nbsp;
<BR>
RepeatEnd
<BR>&nbsp;
<BR>
17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F&nbsp;&nbsp;/&nbsp;&nbsp;/&nbsp;z!
<BR>
cut&nbsp;-1
<BR>&nbsp;
<BR>&nbsp;
<BR></B>
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 ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>Groove Metronome2-4 </B></BLOCKQUOTE>
   
	</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
<B>4/4</B> pattern. In order to ``sound'' the metronome, we need
to create an empty bar:

<P>

      <TABLE ALIGN="CENTER" CELLSPACING=0 CELLPADDING=5 BGCOLOR="OldLace" BORDER=3>
        <TR> <TD>
   
<BLOCKQUOTE><B>&nbsp;&nbsp;&nbsp;z * 2 </B></BLOCKQUOTE>
   
	</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>
<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>
<!--End of Navigation Panel-->
<ADDRESS>
Bob
2006-10-15
</ADDRESS>
</BODY>
</HTML>