next up previous
Next: Variables, Conditionals and Jumps Up: Reference Manaul Previous: Volume and Dynamics


Repeats

MMA attempts to be as comfortable to use as standard sheet music. This includes repeats and endings.

More complex structures like D.S., Coda, etc. are not directly supported. But, they are easily simulated with by using some simple variables, conditionals and Gotos. See chapter 15 for details. Often as not, it may be easier to use your editor to cut, paste and duplicate. Another, alternate, method of handling complicated repeats is to set sections of code in Mset ([*]) variables and simply expand those.

A section of music to be repeated is indicated with a Repeat and Repeatend or EndRepeat14.1 In addition, you can have RepeatEndings.

Example 14.1: Repeats


\includegraphics[width=.9\textwidth]{mupex/repeat.ps}



Repeat
1 Am
2 C
RepeatEnding 2
3 D7
RepeatEnding
4 D7 / Dm
RepeatEnd
5 G7
6 A


In example 14.1 MMA produces music with bars:

1, 2, 3,
1, 2, 3,
1, 2, 4,
1, 2, 5, 6

This works just like standard sheet music. Note that both RepeatEnding and RepeatEnd can take an optional argument indicating the number of times to use the ending or to repeat the block. The effect of an optional count for RepeatEnding is illustrated in the example, above. The following simple example:

Repeat
1  Am
2  Cm
RepeatEnd 3

Will expand to:

1, 2,
1, 2,
1, 2

Note that the optional argument ``3'' produces a total of three copies. The default argument for Repeat is ``2'' (values less than 2 are not permitted).

Combining optional counts with both RepeatEnding and RepeatEnd is permitted. However, the final repeats will not include the endings. Another example:

Repeat
1 Am
2 C
RepeatEnding 2
3 D7
RepeatEnd 2

Produces:

1, 2, 3,
1, 2, 3,
1, 2,
1, 2

MMA processes repeats by reading the input file and creating duplicates of the repeated material. This means that a directive in the repeated material would be processed multiple times. Unless you know what you are doing, directives should not be inserted in repeat sections. Be especially careful if you define a pattern inside a repeat. Using Tempo with a ``+'' or ``-'' will be problematic as well.

Repeats can be nested to any level.

There must be one RepeatEnd or EndRepeat for every Repeat. Any number of RepeatEndings can be included before the RepeatEnd.


Footnotes

...EndRepeat14.1
The reason for both EndRepeat and RepeatEnd is that we have both IfEnd and EndIf.

next up previous
Next: Variables, Conditionals and Jumps Up: Reference Manaul Previous: Volume and Dynamics
Bob 2004-12-02