2009-05-17 22:34:44 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2006-11-10 08:07:56 +00:00
2011-07-26 22:49:39 +00:00
<!-- Converted with LaTeX2HTML 2008 (1.71)
2006-11-10 08:07:56 +00:00
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 >
2011-07-26 22:49:39 +00:00
< TITLE > Variables, Conditionals and Jumps< / TITLE >
< META NAME = "description" CONTENT = "Variables, Conditionals and Jumps" >
2006-11-10 08:07:56 +00:00
< META NAME = "keywords" CONTENT = "mma" >
< META NAME = "resource-type" CONTENT = "document" >
< META NAME = "distribution" CONTENT = "global" >
2011-07-26 22:49:39 +00:00
< META HTTP-EQUIV = "Content-Type" CONTENT = "text/html; charset=utf-8" >
< META NAME = "Generator" CONTENT = "LaTeX2HTML v2008" >
2006-11-10 08:07:56 +00:00
< META HTTP-EQUIV = "Content-Style-Type" CONTENT = "text/css" >
< LINK REL = "STYLESHEET" HREF = "mma.css" >
< LINK REL = "next" HREF = "node21.html" >
< LINK REL = "previous" HREF = "node19.html" >
< LINK REL = "up" HREF = "mma.html" >
< LINK REL = "next" HREF = "node21.html" >
< / HEAD >
< BODY bgcolor = "#ffffff" >
2009-05-17 22:34:44 +00:00
< DIV CLASS = "navigation" > <!-- Navigation Panel -->
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html700"
2006-11-10 08:07:56 +00:00
HREF="node21.html">
< IMG WIDTH = "37" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "next" SRC = "next.png" > < / A >
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html698"
2006-11-10 08:07:56 +00:00
HREF="mma.html">
< IMG WIDTH = "26" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "up" SRC = "up.png" > < / A >
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html692"
2006-11-10 08:07:56 +00:00
HREF="node19.html">
< IMG WIDTH = "63" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "previous" SRC = "prev.png" > < / A >
< BR >
2011-07-26 22:49:39 +00:00
< B > Next:< / B > < A NAME = "tex2html701"
HREF="node21.html">Low Level MIDI Commands< / A >
< B > Up:< / B > < A NAME = "tex2html699"
2006-11-10 08:07:56 +00:00
HREF="mma.html">Reference Manual< / A >
2011-07-26 22:49:39 +00:00
< B > Previous:< / B > < A NAME = "tex2html693"
HREF="node19.html">Repeats< / A >
2006-11-10 08:07:56 +00:00
< BR >
2009-05-17 22:34:44 +00:00
< BR > < / DIV >
2006-11-10 08:07:56 +00:00
<!-- End of Navigation Panel -->
<!-- Table of Child - Links -->
< A NAME = "CHILD_LINKS" > < STRONG > Subsections< / STRONG > < / A >
2009-05-17 22:34:44 +00:00
< UL CLASS = "ChildLinks" >
2011-07-26 22:49:39 +00:00
< LI > < A NAME = "tex2html702"
HREF="node20.html#SECTION002010000000000000000">Variables< / A >
2006-11-10 08:07:56 +00:00
< UL >
2011-07-26 22:49:39 +00:00
< LI > < A NAME = "tex2html703"
HREF="node20.html#SECTION002011000000000000000">Set< / A >
< LI > < A NAME = "tex2html704"
HREF="node20.html#SECTION002012000000000000000">NewSet< / A >
< LI > < A NAME = "tex2html705"
HREF="node20.html#SECTION002013000000000000000">Mset< / A >
< LI > < A NAME = "tex2html706"
HREF="node20.html#SECTION002014000000000000000">RndSet< / A >
< LI > < A NAME = "tex2html707"
HREF="node20.html#SECTION002015000000000000000">UnSet VariableName< / A >
< LI > < A NAME = "tex2html708"
HREF="node20.html#SECTION002016000000000000000">ShowVars< / A >
< LI > < A NAME = "tex2html709"
HREF="node20.html#SECTION002017000000000000000">Inc and Dec< / A >
< LI > < A NAME = "tex2html710"
HREF="node20.html#SECTION002018000000000000000">VExpand On or Off< / A >
< LI > < A NAME = "tex2html711"
HREF="node20.html#SECTION002019000000000000000">StackValue< / A >
2009-05-17 22:34:44 +00:00
< / UL >
< BR >
2011-07-26 22:49:39 +00:00
< LI > < A NAME = "tex2html712"
HREF="node20.html#SECTION002020000000000000000">Predefined Variables< / A >
< LI > < A NAME = "tex2html713"
HREF="node20.html#SECTION002030000000000000000">Indexing and Slicing< / A >
< LI > < A NAME = "tex2html714"
HREF="node20.html#SECTION002040000000000000000">Mathematical Expressions< / A >
< LI > < A NAME = "tex2html715"
HREF="node20.html#SECTION002050000000000000000">Conditionals< / A >
< LI > < A NAME = "tex2html716"
HREF="node20.html#SECTION002060000000000000000">Goto< / A >
2006-11-10 08:07:56 +00:00
< / UL >
<!-- End of Table of Child - Links -->
< HR >
< H1 > < A NAME = "SECTION002000000000000000000" > < / A >
2011-07-26 22:49:39 +00:00
< A NAME = "sec-variables" > < / A >
2006-11-10 08:07:56 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Variables, Conditionals and Jumps
2006-11-10 08:07:56 +00:00
< / H1 >
< P >
2011-07-26 22:49:39 +00:00
To make the processing of your music easier,
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > supports a very
primitive set for variable manipulations along with some conditional
testing and the oft-frowned-upon < SMALL > GOTO< / SMALL > command.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002010000000000000000" >
Variables< / A >
< / H1 >
2006-11-10 08:07:56 +00:00
< P >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > lets you set a variable, much like in other programming
languages and to do some basic manipulations on them. Variables are
most likely to be used for two reasons:
< P >
< UL >
< LI > For use in setting up conditional segments of your file,
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > As a shortcut to entering complex chord sequences.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< / UL >
2006-11-10 08:07:56 +00:00
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
To begin, the following list shows the available commands to set and
manipulate variables:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set VariableName < SPAN CLASS = "textit" > String< / SPAN >
< BR >
Mset VariableName ...MsetEnd
< BR >
UnSet VariableName
< BR >
ShowVars
< BR >
Inc Variablename [value]
< BR >
Dec Variablename [value]
< BR >
Vexpand ON/Off < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
All variable names are case-insensitive. Any characters can be used in
a variable name. The only exceptions are that a variable name cannot
start with a “ $” or a “ _” (an underscore--this is reserved for
internal variables, see below) < SPAN CLASS = "textit" > and< / SPAN > names cannot contain a
“ [” or “ ]” character (brace characters are reserved for
indexing, < A HREF = "#slicing" > details here< / A > ).
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Variables are set and manipulated by using their names. Variables are
expanded when their name is prefaced by a space followed by single
“ $” sign. For example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set Silly Am / Bm /
< BR >
1 $Silly < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
The first line creates the variable “ Silly” ; the second creates a
bar of music with the chords “ Am / Bm /” .
2006-11-10 08:07:56 +00:00
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Note that the “ $” must be the first item on a line or follow a
space character. For example, the following will NOT work:
2006-11-10 08:07:56 +00:00
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Set Silly 4a;b;c;d;
< BR >
1 Am {$Silly} < / B >
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
However:
2006-11-10 08:07:56 +00:00
< P >
2009-05-17 22:34:44 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > 1 Am { $Silly} < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
will work fine.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Following are details on all the available variable commands:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002011000000000000000" >
Set< / A >
< / H2 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Set or create a variable. You can skip the < SPAN CLASS = "textit" > String< / SPAN > if you do
want to assign an empty string to the variable. A valid example is:
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Set PassCount 1 < / B >
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
You can concatenate variables or constants by using a single “ +” .
For example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Groove Rhumba
< BR >
Repeat
< BR > ...
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Set a $_Groove + Sus
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Groove $a
< BR > ...
< BR >
Groove Rhumba1
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Repeatend < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
This can be useful in calling G< SMALL > ROOVE< / SMALL > variations.
< P >
< H2 > < A NAME = "SECTION002012000000000000000" >
NewSet< / A >
< / H2 >
< P >
The N< SMALL > EW< / SMALL > S< SMALL > ET< / SMALL > command works the same as S< SMALL > ET< / SMALL > with the
exception that that it is completely ignored if the variable already
exists. So,
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > NewSet ChordVoice JazzGuitar < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
and
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If NDef ChordVoice
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Set ChordVoice JazzGuitar
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Endif < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
have identical results.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002013000000000000000" > < / A > < A NAME = "sec-mset" > < / A >
< BR >
Mset
< / H2 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
This command is quite similar to S< SMALL > ET< / SMALL > , but M< SMALL > SET< / SMALL > expects
multiple lines. An example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > MSet LongVar
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
1 Cm
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
2 Gm
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
3 G7
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
MsetEnd < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
It is quite possible to set a variable to hold an entire section of
music (perhaps a chorus) and insert this via macro expansion at
various places in your file.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Each M< SMALL > SET< / SMALL > must be terminated by a E< SMALL > ND< / SMALL > M< SMALL > SET< / SMALL > or
M< SMALL > SET< / SMALL > E< SMALL > ND< / SMALL > command (on its own separate line).
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Be careful if you use an MS< SMALL > ET< / SMALL > variable in a P< SMALL > RINT< / SMALL >
statement ... you'll probably get an error. The P< SMALL > RINT< / SMALL >
command will print the < SPAN CLASS = "textit" > first< / SPAN > line of the variable and the
remainder will be reinserted into the input stream for interpretation.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Special code in
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > will maintain the block settings from
B< SMALL > EGIN< / SMALL > /E< SMALL > ND< / SMALL > . So, you can do something like:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Mset Spam
< BR > Line one
< BR > Line 2
< BR > 333
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
EndMset
< BR >
Begin Print
< BR > $Spam
< BR >
End < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002014000000000000000" > < / A >
< A NAME = "rndset" > < / A >
< BR >
RndSet
< / H2 >
< P >
There are times when you may want a random value to use in selecting a
G< SMALL > ROOVE< / SMALL > or for other more creative purposes. The R< SMALL > ND< / SMALL > S< SMALL > ET< / SMALL >
command sets a variable from a value in a list. The list can be
anything; just remember that each white space forms the start of a new
item. So,
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > RndSet Var 1 2 3 4 5 < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
will set $V< SMALL > AR< / SMALL > to one of the values 1, 2, 3, 4 or 5.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
You could use this to randomly select a G< SMALL > ROOVE< / SMALL > :
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Groove $var Groove1 Groove2 Groove3 < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Alternately,
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > RndSet Grv Groove1 Groove2 Groove3 < / B >
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
will set $G< SMALL > RV< / SMALL > to one of “ Groove1” , “ Groove2” or
“ Groove3” .
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Then you can do the same as in the earlier example with:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Groove $Grv < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
You can also have fun using random values for timing, transposition,
etc.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002015000000000000000" >
UnSet VariableName< / A >
< / H2 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Removes the variable. This can be useful if you have conditional tests
which simply rely on a certain variable being “ defined” .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002016000000000000000" >
ShowVars< / A >
< / H2 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Mainly used for debugging, this command displays the names of the
defined variables and their contents. The display will preface each
variable name with a “ $” . Note that internal
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > variables are
not displayed with this command.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
You can call S< SMALL > HOW< / SMALL > V< SMALL > ARS< / SMALL > with an argument list. In this case the
values of the variables names in the list will be printed. Variables
which do not exist will < SPAN CLASS = "textit" > not< / SPAN > cause an error, e.g.:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > ShowVars xXx Count foo
< BR > $XXX - not defined
< BR > $COUNT: 11
< BR > $FOO: This is Foo < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2006-11-10 08:07:56 +00:00
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002017000000000000000" >
Inc and Dec< / A >
< / H2 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
These commands increment or decrement a variable. If no argument is
given, a value of 1 is used; otherwise, the value specified is used.
The value can be an integer or a floating point number.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
A short example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set PassCount 1
< BR >
Set Foobar 4
< BR >
Showvars
< BR >
Inc FooBar 4
< BR >
Inc PassCount
< BR >
ShowVars < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
This command is quite useful for creating conditional tests for proper
handling of codas or groove changes in repeats.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H2 > < A NAME = "SECTION002018000000000000000" >
VExpand On or Off< / A >
< / H2 >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
Normally variable expansion is enabled. These two options will turn
expansion on or off. Why would you want to do this? Well, here's a
simple example:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Set LeftC Am Em
< BR >
Set RightC G /
< BR >
VExpand Off
< BR >
Set Full $LeftC $RightC
< BR >
VExpand On < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
In this case the actual contents of the variable “ Full” is “ $LeftC
$RightC” . If the O< SMALL > FF/< / SMALL > O< SMALL > N< / SMALL > option lines had not been used, the
contents would be “ Am Em G /” . You can easily verify this with the
S< SMALL > HOW< / SMALL > V< SMALL > ARS< / SMALL > option.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
When
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > processes a file it expands variables in a recursive
manner. This means that, in the above example, the line:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > 1 $Full < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
will be changed to:
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > 1 Am Em G / < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
However, if later in the file, you change the definition of one of the
variables ... for example:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Set LeftC Am / < / B >
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
the same line will now be “ 1 Am / G /” .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Most of
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > 's internal commands < SPAN CLASS = "textit" > can< / SPAN > be redefined with
variables. However, you really shouldn't use this feature. It's been
left for two reasons: it might be useful, and, it's hard to disable.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
However, not all commands can be redefined. The following is short
list of things which will work (but, again, not all suggestions should
be used!):
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set Rate Tempo 120
< BR > $Rate
< BR >
Set R Repeat
< BR > $R < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
But, the following will < SPAN CLASS = "textit" > not< / SPAN > work:
2006-11-10 08:07:56 +00:00
< P >
2009-05-17 22:34:44 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set B Begin
< BR >
Set E End
< BR > $B Arpeggio Define
< BR > ...
< BR > $E < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
This fails since the Begin/End constructs are expanded before variable
expansion. However:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set A Define Arpeggio
< BR >
Begin $a ...End < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
is quite alright.
< P >
Even though you can use a variable to substitute for the R< SMALL > EPEAT< / SMALL >
or I< SMALL > F< / SMALL > directives, using one for R< SMALL > EPEAT< / SMALL > E< SMALL > ND< / SMALL > ,
E< SMALL > ND< / SMALL > R< SMALL > EPEAT< / SMALL > , R< SMALL > EPEAT< / SMALL > E< SMALL > NDING< / SMALL > , L< SMALL > ABEL< / SMALL > , I< SMALL > F< / SMALL > E< SMALL > ND< / SMALL > or
E< SMALL > ND< / SMALL > I< SMALL > F< / SMALL > will fail.
< P >
Variable expansion should usually not be a concern. In most normal
files,
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > will expand variables as they are encountered. However,
when reading the data in a R< SMALL > EPEAT< / SMALL > , I< SMALL > F< / SMALL > or M< SMALL > SET< / SMALL >
section the expansion function is skipped--but, when the lines are
processed, after being stored in an internal queue, variables are
expanded.
< P >
< H2 > < A NAME = "SECTION002019000000000000000" >
StackValue< / A >
< / H2 >
< P >
Sometimes you just want to save a value for a few lines of code. The
S< SMALL > TACK< / SMALL > V< SMALL > ALUE< / SMALL > command will save its arguments. You can later
retrieve them via the $_StackValue macro. For example (taken from
the < TT > < SPAN CLASS = "textbf" > stdpats.mma< / SPAN > < / TT > file):
2006-11-10 08:07:56 +00:00
< P >
2009-05-17 22:34:44 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > StackValue $_SwingMode
< BR >
SwingMode On
< BR >
Begin Drum Define
< BR > Swing8 1 0 90 * 8
< BR >
End
< BR > ...
< BR >
SwingMode $_StackValue < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
Note that the $_StackValue macro removes the last value from the
stack. If you invoke the macro when there is nothing saved an error
will occur.
2006-11-10 08:07:56 +00:00
< P >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002020000000000000000" >
Predefined Variables< / A >
2009-05-17 22:34:44 +00:00
< / H1 >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
For your convenience
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > tracks a number of internal settings and
you can access these values with special macros.< A NAME = "tex2html70"
HREF="#foot9019">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 1< / SPAN > < / SUP > < / A > All of these “ system” variables are
prefaced with a single underscore. For example, the current tempo is
displayed with the variable $_TEMPO.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
There are two categories of system variables. The first are the simple
values for global settings:
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< DL >
< DT > < STRONG > $_AutoLibPath< / STRONG > < / DT >
< DD > Current A< SMALL > UTO< / SMALL > L< SMALL > IB< / SMALL > P< SMALL > ATH< / SMALL > setting.
< P >
< / DD >
< DT > < STRONG > $_BarNum< / STRONG > < / DT >
< DD > Current bar number of song.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_Debug< / STRONG > < / DT >
< DD > Current debug settings.
< P >
< / DD >
< DT > < STRONG > $_Groove< / STRONG > < / DT >
< DD > Name of the currently selected groove. May be
empty if no groove has been selected.
< P >
< / DD >
< DT > < STRONG > $_KeySig< / STRONG > < / DT >
< DD > Key signature as defined in song file. If no key
signature is set the somewhat cryptic 0# will be returned.
< P >
< / DD >
< DT > < STRONG > $_IncPath< / STRONG > < / DT >
< DD > Current I< SMALL > NC< / SMALL > P< SMALL > ATH< / SMALL > setting.
< P >
< / DD >
< DT > < STRONG > $_LastDebug< / STRONG > < / DT >
< DD > Debug settings prior to last D< SMALL > EBUG< / SMALL >
command. This setting can be used to restore settings, e.g.:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Debug Warnings=off
< BR > ...stuff generating annoying warnings
< BR >
Debug $_LastDebug < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_LastGroove< / STRONG > < / DT >
< DD > Name of the groove selected < SPAN CLASS = "textit" > before< / SPAN > the
currently selected groove.
< P >
< / DD >
< DT > < STRONG > $_LastVolume< / STRONG > < / DT >
< DD > Previously set global volume setting.
2006-11-10 08:07:56 +00:00
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_LibPath< / STRONG > < / DT >
< DD > Current L< SMALL > IB< / SMALL > P< SMALL > ATH< / SMALL > setting.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / DD >
< DT > < STRONG > $_LineNum< / STRONG > < / DT >
< DD > Line number in current file.
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_Lyric< / STRONG > < / DT >
< DD > Current L< SMALL > YRIC< / SMALL > settings.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / DD >
< DT > < STRONG > $_MIDISplit< / STRONG > < / DT >
< DD > List of S< SMALL > PLIT< / SMALL > C< SMALL > HANNELS< / SMALL > .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_OutPath< / STRONG > < / DT >
< DD > Current O< SMALL > UT< / SMALL > P< SMALL > ATH< / SMALL > setting.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_MIDIPlayer< / STRONG > < / DT >
< DD > Current M< SMALL > IDI< / SMALL > P< SMALL > LAYER< / SMALL > setting, including options.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_Seq< / STRONG > < / DT >
< DD > Current S< SMALL > EQ< / SMALL > point (0 to
S< SMALL > EQ< / SMALL > S< SMALL > IZE< / SMALL > ). Useful in debugging.
< P >
< / DD >
< DT > < STRONG > $_SeqRnd< / STRONG > < / DT >
< DD > Global S< SMALL > EQ< / SMALL > R< SMALL > ND< / SMALL > setting (on, off or track
list).
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_SeqRndWeight< / STRONG > < / DT >
< DD > Global S< SMALL > EQ< / SMALL > R< SMALL > ND< / SMALL > W< SMALL > EIGHT< / SMALL > settings.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_SeqSize< / STRONG > < / DT >
< DD > Current S< SMALL > EQ< / SMALL > S< SMALL > IZE< / SMALL > setting.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_SwingMode< / STRONG > < / DT >
< DD > Current S< SMALL > WING< / SMALL > M< SMALL > ODE< / SMALL > setting (On or Off)
and the Skew value.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_StackValue< / STRONG > < / DT >
< DD > The last value stored on the S< SMALL > TACK< / SMALL > V< SMALL > ALUE< / SMALL >
stack.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_Tempo< / STRONG > < / DT >
< DD > Current T< SMALL > EMPO< / SMALL > . Note that if you have used
the optional < SPAN CLASS = "textit" > bar count< / SPAN > in setting the tempo this will be the
target tempo.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_Time< / STRONG > < / DT >
< DD > The current T< SMALL > IME< / SMALL > (beats per bar) setting.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_ToneTr< / STRONG > < / DT >
< DD > List of all T< SMALL > ONE< / SMALL > TR settings.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_Transpose< / STRONG > < / DT >
< DD > Current T< SMALL > RANSPOSE< / SMALL > setting.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > $_VExpand< / STRONG > < / DT >
< DD > VExpand value (On/Off). Not very useful since you
can't enable VEXPAND back with a macro.
< P >
< / DD >
< DT > < STRONG > $_VoiceTr< / STRONG > < / DT >
< DD > List of all V< SMALL > OICE< / SMALL > TR settings.
2009-05-17 22:34:44 +00:00
< P >
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < STRONG > $_Volume< / STRONG > < / DT >
< DD > Current global volume setting.
< P >
< / DD >
< DT > < STRONG > $_VolumeRatio< / STRONG > < / DT >
< DD > Global volume ratio (track vrs. master) from
A< SMALL > DJUST< / SMALL > V< SMALL > OLUME< / SMALL > Ratio setting.
< P >
< / DD >
< / DL >
< P >
The second type of system variable is for settings in a certain track.
Each of these variables is in the form $_TRACKNAME_VALUE. For
example, the current voice setting for the “ Bass-Sus” track can be
accessed with the variable $_Bass-Sus_Voice.
< P >
If the associated command permits a value for each sequence in your
pattern, the macro will more than one value. For example (assuming a
S< SMALL > EQ< / SMALL > S< SMALL > IZE< / SMALL > of 4):
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Bass Octave 3 4 2 4
< BR >
Print $_Bass_Octave
< BR > ...
< BR >
3 4 2 4 < / B >
< / td > < / tr >
< / Table >
< P >
The following are the available “ TrackName” macros:
< P >
< DL >
< DT > < STRONG > $_TRACKNAME_Accent< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Articulate< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Channel< / STRONG > < / DT >
< DD > Assigned MIDI channel 1-16, 0 if not
assigned.
< / DD >
< DT > < STRONG > $_TRACKNAME_Compress< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Direction< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_DupRoot< / STRONG > < / DT >
< DD > (only permitted in Chord Tracks)
< / DD >
< DT > < STRONG > $_TRACKNAME_Harmony< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_HarmonyVolume< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Invert< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Limit< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Mallet< / STRONG > < / DT >
< DD > Rate and delay values (only valid in
Solo and Melody tracks)
< / DD >
< DT > < STRONG > $_TRACKNAME_MidiNote< / STRONG > < / DT >
< DD > Current setting
< / DD >
< DT > < STRONG > $_TRACKNAME_NoteSpan< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Octave< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Range< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Rskip< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Rtime< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Rvolume< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_SeqRnd< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_SeqRndWeight< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Sequence< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Span< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Strum< / STRONG > < / DT >
< DD > (only permitted in Chord tracks)
< / DD >
< DT > < STRONG > $_TRACKNAME_Tone< / STRONG > < / DT >
< DD > (only permitted in Drum tracks)
< / DD >
< DT > < STRONG > $_TRACKNAME_Unify< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Voice< / STRONG > < / DT >
< DD >
< / DD >
< DT > < STRONG > $_TRACKNAME_Voicing< / STRONG > < / DT >
< DD > (only permitted in Chord tracks)
< / DD >
< DT > < STRONG > $_TRACKNAME_Volume< / STRONG > < / DT >
< DD > < P >
< / DD >
2009-05-17 22:34:44 +00:00
< / DL >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
The “ TrackName” macros are useful in copying values between
non-similar tracks and C< SMALL > H< / SMALL > S< SMALL > HARE< / SMALL > tracks. For example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Begin Bass
< BR > Voice AcousticBass
< BR > Octave 3
< BR > ...
< BR >
End
< BR >
Begin Walk
< BR > ChShare Bass
< BR > Voice $_Bass_Voice
< BR > Octave $_Bass_Octave
< BR > ...
< BR >
End < / B >
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002030000000000000000" > < / A >
< A NAME = "slicing" > < / A >
< BR >
Indexing and Slicing
< / H1 >
< P >
All variables can have an option < SPAN CLASS = "textit" > slice< / SPAN > or < SPAN CLASS = "textit" > index< / SPAN > appended
to them using “ []” notation. The exact syntax of the data in the
“ []” s is dependent on the underlying Python interpreter. But, as a
summary:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< DL COMPACT >
< DT > < / DT >
< DD > < SPAN CLASS = "textbf" > [2]< / SPAN > - selects the 3rd item in the list,
< / DD >
< DT > < / DT >
< DD > < SPAN CLASS = "textbf" > [1:2]< / SPAN > - selects the 2nd to 3rd item (which means only the
2nd),
< / DD >
< DT > < / DT >
< DD > < SPAN CLASS = "textbf" > [0:2]< / SPAN > - selects items 1 and 2,
< / DD >
< DT > < / DT >
< DD > < SPAN CLASS = "textbf" > [-1]< / SPAN > - selects the last item.
< / DD >
< / DL >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
It is possible to use the < SPAN CLASS = "textit" > step< / SPAN > option as well, but we don't
know when you would.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
When indexing or slicing a variable, the following should be kept in
mind:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< UL >
< LI > For simple variables which contain only one element
(ie. $_Tempo) any index other than “ [0]” , “ [-1]” , etc. will
return an empty string.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > Variables containing multiple values (ie. $_Bass_Volume) are
treated as list. Slicing and indexing is useful to extract a single
value.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > Variables created with M< SMALL > SET< / SMALL > are treated a list of
lines. Slicing returns multiple (or single) lines. This can be
useful in selecting only a portion of a previously created variable.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
< / UL >
2011-07-26 22:49:39 +00:00
The “ []” must follow the variable < SPAN CLASS = "textit" > without< / SPAN > any space
characters. The expression inside the “ []” must not contain any
spaces.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The index or slice expression cannot be a variable.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
An example:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Groove bossanova
< BR >
Bass Volume m mf p mp
< BR >
print $_Bass_Volume
< BR >
print $_Bass_Volume[1:3]
< BR >
print $_Bass_volume[2] < / B >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
< P >
2011-07-26 22:49:39 +00:00
will display:
2006-11-10 08:07:56 +00:00
< P >
2007-04-29 06:47:40 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > 100 110 40 70
< BR >
110 40
< BR >
40 < / B >
2007-04-29 06:47:40 +00:00
< / td > < / tr >
< / Table >
2006-11-10 08:07:56 +00:00
2007-04-29 06:47:40 +00:00
< P >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002040000000000000000" >
Mathematical Expressions< / A >
2009-05-17 22:34:44 +00:00
< / H1 >
< P >
2011-07-26 22:49:39 +00:00
Anywhere you can use a variable (user defined or built-in) you can
also use a mathematical expression. Expressions delimited in a
$(...) set are passed to the underlying Python interpreter, parsed
and expanded. Included in an expression can be any combination of
values, operators, and
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > variables.
< P >
Here are a couple of examples with the
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > generated values:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Print $( 123 * (4.0/5) )
< BR >
98.4 < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Tempo 100
< BR >
Set V $( $_Tempo + 44)
< BR >
Print $v
< BR >
144 < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
How it works:
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > first parses each line and expands any variables
it finds. In the second example this means that the $_Tempo is
converted to “ 100” . After all the variable expansion is done a check
is made to find math delimiters. Anything inside these delimiters is
evaluated by Python.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
You can even use this feature to modify values stored in
lists.< A NAME = "tex2html71"
HREF="#foot9165">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 2< / SPAN > < / SUP > < / A > A bit complex, but well worthwhile! In the following
example we add “ 10” to the current A< SMALL > RTICULATE< / SMALL > setting. It's
split into three lines to make it clearer:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > set a $( ' $_Chord_Articulate '.split() ) < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
Note the use of single quotes to convert the
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > “ string” to
something Python can deal with. You could just as easily use double
quotes, but do note that the spaces before the “ $” and before the
final “ ' ” are needed. The result of the above is that the variable
“ $a” now is set to something like: “ ['100', '100', '90', '80']” .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > set b $([str(int(x)+10)for x in $a ] ) < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Next we use a list comprehension to add “ 10” to each value in the
list. Our new list (contained in “ $b” ) will be: “ ['110', '110',
'100', '90']” . Notice how the strings were converted from strings to
integers (for the addition) and then back to strings.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > set c $( ' '.join( $b ) ) < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The new list is now converted to a string which
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > can deal with
and store it in “ $c” . In this case: “ 110 110 100 90” .
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Chord Articulate $c < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
Finally, C< SMALL > HORD< / SMALL > A< SMALL > RTICULATE< / SMALL > is modified.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Now, that that is clear, you can easily combine the operation using no
variables at all:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Chord Articulate $(' '.join([str(int(x)+10)for x in'
$_Chord_Articulate '.split()])) < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
Some additional notes:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< UL >
< LI > To keep your computer safe from malicious scripts, only the
following operators and functions are permitted.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The unary operators:
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< PRE >
- + ~
< / PRE >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
the basic operators:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< PRE >
+ - / // % * **
< / PRE >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
the bitwise operators:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< PRE >
& | ^ < < > >
< / PRE >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
the constants:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< PRE >
e pi
< / PRE >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
the functions:
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< PRE >
ceil() fabs() floor() exp() log() log10() pow()
sqrt() acos() asin() atan() atan2() cos() hypot()
sin() tan() degrees() radians() cosh() sinh()
tanh() abs() chr() int()
< / PRE >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
the miscellaneous functions:< A NAME = "tex2html72"
HREF="#foot9098">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 3< / SPAN > < / SUP > < / A >
< P >
< PRE >
for, in, str(), .join(), .split()
< / PRE >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
and values and parentheses.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > For details on the use/format of the above please refer to the
Python documentation.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > $(...) expressions cannot be nested.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / LI >
< LI > There must be a whitespace character before the leading $.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > Any
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > variables must be delimited with whitespace. For
example $( $_Tempo + 44) will work; however, both $($_Tempo +
44) and $( $_Tempo+ 44) will cause an error.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > The supplied file < TT > < SPAN CLASS = "textbf" > egs/misc/math.mma< / SPAN > < / TT > shows a number of
examples.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / LI >
< / UL >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002050000000000000000" >
Conditionals< / A >
< / H1 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
One of the most important reasons to have variables in
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > is to use
them in conditionals. In
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > a conditional consists of a line
starting with an I< SMALL > F< / SMALL > directive, a test, a series of lines to
process (depending upon the result of the test), and a closing
E< SMALL > ND< / SMALL > I< SMALL > F< / SMALL > or I< SMALL > F< / SMALL > E< SMALL > ND< / SMALL > < A NAME = "tex2html73"
HREF="#foot9166">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 4< / SPAN > < / SUP > < / A > directive. An optional E< SMALL > LSE< / SMALL > statement may be included.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The first set of tests are unary (they take no arguments):
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< DL >
< DT > < STRONG > Def VariableName< / STRONG > < / DT >
< DD > Returns true if the variable has been defined.
< P >
< / DD >
< DT > < STRONG > Ndef VariableName< / STRONG > < / DT >
< DD > Returns true if the variable has not been
defined.
< P >
< / DD >
< / DL >
< P >
In the above tests you must supply the name of a variable--don't make
the mistake of including a “ $” which will invoke expansion and
result in something you were not expecting.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
A simple example:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If Def InCoda
< BR > 5 Cm
< BR > 6 /
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Endif < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
The other tests are binary (they take two arguments):
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< DL >
< DT > < STRONG > LT Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > Str1< / SPAN > is less than
< SPAN CLASS = "textit" > Str2< / SPAN > . (Please see the discussion below on how the tests are
done.)
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > LE Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > str1< / SPAN > is less than or equal
to < SPAN CLASS = "textit" > Str2< / SPAN > .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< DT > < STRONG > EQ Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > str1< / SPAN > is equal to
< SPAN CLASS = "textit" > Str2< / SPAN > .
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / DD >
< DT > < STRONG > NE Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > str1< / SPAN > is not equal to
< SPAN CLASS = "textit" > Str2< / SPAN > .
< P >
< / DD >
< DT > < STRONG > GT Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > str1< / SPAN > is greater than
< SPAN CLASS = "textit" > Str2< / SPAN > .
< P >
< / DD >
< DT > < STRONG > GE Str1 Str2< / STRONG > < / DT >
< DD > Returns true if < SPAN CLASS = "textit" > str1< / SPAN > is greater than or
equal to < SPAN CLASS = "textit" > Str2< / SPAN > .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / DD >
< / DL >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
In the above tests you have several choices in specifying < SPAN CLASS = "textit" > Str1< / SPAN >
and < SPAN CLASS = "textit" > Str2< / SPAN > . At some point, when
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > does the actual comparison,
two strings or numeric values are expected. So, you really could do:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If EQ abc ABC < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
and get a “ true” result. The reason that “ abc” equals “ ABC” is
that all the comparisons in
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > are case-insensitive.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
You can also compare a variable to a string:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If GT $foo abc < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
will evaluate to “ true” if the < SPAN CLASS = "textit" > contents< / SPAN > of the variable
“ foo” evaluates to something “ greater than” “ abc” . But, there is
a bit of a “ gotcha” here. If you have set “ foo” to a two word
string, then
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > will choke on the command. In the following
example:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set Foo A B
< BR >
If GT $Foo abc < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
the comparison is passed the line:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > If GT A B abc < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
and
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > seeing three arguments generates an error. If you want the
comparison done on a variable which might be more than one word, use
the “ $$” syntax. This delays the expansion of the variable until
the I< SMALL > F< / SMALL > directive is entered. So:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If $$foo abc < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
would generate a comparison between “ A B” and “ ABC” .
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Delayed expansion can be applied to either variable. It only works in
an I< SMALL > F< / SMALL > directive.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Strings and numeric values can be confusing in comparisons. For
example, if you have the strings “ 22” and ” 3” and compare them as
strings, “ 3” is greater than “ 22” ; however, if you compare them as
values then 3 is less than 22.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The rule in
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > is quite simple: If either string in a comparison is
a numeric value, both strings are converted to values. Otherwise they
are compared as strings.< A NAME = "tex2html74"
HREF="#foot9139">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 5< / SPAN > < / SUP > < / A >
< P >
This lets you do consistent comparisons in situations like:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Set Count 1
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
If LE $$Count 4
< BR > ...
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
IfEnd < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
Note that the above example could have used “ $Count” , but you
should probably always use the “ $$” in tests.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
Much like other programming languages, an optional E< SMALL > LSE< / SMALL >
condition may be used:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If Def Coda
< BR > Groove Rhumba1
< BR >
Else
< BR > Groove Rhumba
< BR >
Endif < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
The E< SMALL > LSE< / SMALL > statement(s) are processed only if the test for the
I< SMALL > F< / SMALL > test is false.
< P >
Nesting of I< SMALL > F< / SMALL > s is permitted:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > If ndef Foo
< BR > Print Foo has been defined.
< BR >
Else
< BR > If def bar
< BR > Print bar has been defined. Cool.
< BR > Else
< BR > Print no bar ...go thirsty.
< BR > Endif
2009-05-17 22:34:44 +00:00
< BR >
2011-07-26 22:49:39 +00:00
Endif < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
works just fine. Indentation has been used in these examples to
clearly show the nesting and conditions. You should do the same.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< H1 > < A NAME = "SECTION002060000000000000000" >
Goto< / A >
< / H1 >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The G< SMALL > OTO< / SMALL > command redirects the execution order of your script
to the point at which a L< SMALL > ABEL< / SMALL > or line number has been
defined. There are really two parts to this:
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< OL >
< LI > A command defining a label, and,
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > The G< SMALL > OTO< / SMALL > command.
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
< / LI >
< / OL >
2009-05-17 22:34:44 +00:00
< P >
< P >
2011-07-26 22:49:39 +00:00
A label is set with the L< SMALL > ABEL< / SMALL > directive:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Label Point1 < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
The string defining the label can be any sequence of characters.
Labels are case-insensitive.
< P >
To make this look a lot more line those old BASIC programs, any lines
starting with a line number are considered to be label lines as well.
< P >
A few considerations on labels and line numbers:
2009-05-17 22:34:44 +00:00
< P >
< UL >
2011-07-26 22:49:39 +00:00
< LI > A duplicate label generated with a L< SMALL > ABEL< / SMALL > command will
generate an error.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > A line number label duplicating a L< SMALL > ABEL< / SMALL > is an error.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > A L< SMALL > ABEL< / SMALL > duplicating a line number is an error.
2009-05-17 22:34:44 +00:00
< P >
< / LI >
2011-07-26 22:49:39 +00:00
< LI > Duplicate line numbers are permitted. The last one encountered
will be the one used.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > All label points are generated when the file is opened, not as
it is parsed.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< LI > Line numbers (really, just comments) do not need to be in any
order.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< / LI >
< / UL >
2009-05-17 22:34:44 +00:00
2011-07-26 22:49:39 +00:00
< P >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The command:
2009-05-17 22:34:44 +00:00
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
2011-07-26 22:49:39 +00:00
< B > Goto Point1 < / B >
2009-05-17 22:34:44 +00:00
< / td > < / tr >
< / Table >
< P >
2011-07-26 22:49:39 +00:00
causes an immediate jump to a new point in the file. If you are
currently in repeat or conditional segment of the file, the remaining
lines in that segment will be ignored.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > does not check to see if you are jumping into a repeat or
conditional section of code--but doing so will usually cause an
error. Jumping out of these sections is usually safe.
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
The following example shows the use of both types of label. In this
example only lines 2, 3, 5 and 6 will be processed.
< P >
< Table Hspace = "40%" CellSpacing = 0 CellPadding = 10 BGColor = "OldLace" Border = 3 >
< tr > < td >
< B > Goto Foo
< BR >
1 Cm
< BR >
Label Foo
< BR >
2 Dm
< BR >
3 /
< BR >
Goto 5
< BR >
4 Am
< BR >
5 Cm
< BR >
6 Dm < / B >
< / td > < / tr >
< / Table >
2009-05-17 22:34:44 +00:00
< P >
2011-07-26 22:49:39 +00:00
For an example of how to use some simple labels to simulate a “ DS al
Coda” examine the file “ lullaby-of-Broadway” in the sample songs
directory.
2009-05-17 22:34:44 +00:00
< BR > < HR > < H4 > Footnotes< / H4 >
< DL >
2011-07-26 22:49:39 +00:00
< DT > < A NAME = "foot9019" > ... macros.< / A > < A
HREF="node20.html#tex2html70">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 1< / SPAN > < / SUP > < / A > < / DT >
< DD > The values
are dynamically created and reflect the current settings, and may
not be exactly the same as the value you originally set due to
internal roundings, etc.
2009-05-17 22:34:44 +00:00
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < A NAME = "foot9165" > ...
lists.< / A > < A
HREF="node20.html#tex2html71">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 2< / SPAN > < / SUP > < / A > < / DT >
< DD > this was written before the introduction of slices,
(< A HREF = "#slicing" > details here< / A > ). Slices make this
much easier, but lets leave the hard stuff in just to show what can
be done.
2009-05-17 22:34:44 +00:00
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < A NAME = "foot9098" > ... functions:< / A > < A
HREF="node20.html#tex2html72">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 3< / SPAN > < / SUP > < / A > < / DT >
< DD > It is possible that the
following functions could be used to do “ bad” things. If you see
code using these commands from a suspect source you should be
careful.
2009-05-17 22:34:44 +00:00
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < A NAME = "foot9166" > ...I< SMALL > F< / SMALL > E< SMALL > ND< / SMALL > < / A > < A
HREF="node20.html#tex2html73">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 4< / SPAN > < / SUP > < / A > < / DT >
< DD >
< FONT Face = "Serif" Color = "Navy" > < I > MMA< / I > < / FONT > 's author probably suffers
from mild dyslexia and can't remember if the command is IfEnd or
EndIf, so both are permitted. Use whichever is more comfortable for
you.
2009-05-17 22:34:44 +00:00
< / DD >
2011-07-26 22:49:39 +00:00
< DT > < A NAME = "foot9139" > ... strings.< / A > < A
HREF="node20.html#tex2html74">< SUP > < SPAN CLASS = "arabic" > 20< / SPAN > .< SPAN CLASS = "arabic" > 5< / SPAN > < / SUP > < / A > < / DT >
< DD > An attempt is made to convert each
string to a float. If conversion of both strings is successful, the
comparison is made between two floats, otherwise two strings are
used.
2009-05-17 22:34:44 +00:00
< / DD >
< / DL >
< DIV CLASS = "navigation" > < HR >
2006-11-10 08:07:56 +00:00
<!-- Navigation Panel -->
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html700"
2006-11-10 08:07:56 +00:00
HREF="node21.html">
< IMG WIDTH = "37" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "next" SRC = "next.png" > < / A >
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html698"
2006-11-10 08:07:56 +00:00
HREF="mma.html">
< IMG WIDTH = "26" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "up" SRC = "up.png" > < / A >
2011-07-26 22:49:39 +00:00
< A NAME = "tex2html692"
2006-11-10 08:07:56 +00:00
HREF="node19.html">
< IMG WIDTH = "63" HEIGHT = "24" ALIGN = "BOTTOM" BORDER = "0" ALT = "previous" SRC = "prev.png" > < / A >
< BR >
2011-07-26 22:49:39 +00:00
< B > Next:< / B > < A NAME = "tex2html701"
HREF="node21.html">Low Level MIDI Commands< / A >
< B > Up:< / B > < A NAME = "tex2html699"
2006-11-10 08:07:56 +00:00
HREF="mma.html">Reference Manual< / A >
2011-07-26 22:49:39 +00:00
< B > Previous:< / B > < A NAME = "tex2html693"
HREF="node19.html">Repeats< / A > < / DIV >
2006-11-10 08:07:56 +00:00
<!-- End of Navigation Panel -->
< ADDRESS >
2007-04-29 06:47:40 +00:00
bob
2011-07-26 22:49:39 +00:00
2010-11-07
2006-11-10 08:07:56 +00:00
< / ADDRESS >
< / BODY >
< / HTML >