After

In the previous chapter on TRIGGERS we discussed how you can set an event to occur when a certain chord change occurred. This chapter, AFTER, discusses a similar concept: setting an event to occur after a certain number of bars have been processed.

The AFTER command is used to set a MMA command at some point in the future. This can be handy when you have set a portion of your song up in a macro and wish to make changes to volume, tempo, etc. during the expansion of the macro.

For example, let's assume you have a short piece of music set up in the macro $LNS:

Mset Lns
    Am
    C
    Dm
    E
EndMset

and we incorporate this into a MMA script in a number of places. However, at some point we want the TEMPO to slow for the final two bars. Using AFTER we can do:

After Count=2 Tempo *.9
$LNS

And have the command TEMPO *.9 inserted between the second and third bars.

AFTER has a number of options, all of which are set in option=value pairs:

 
Bar
Specifies the bar number for the event to trigger. Note, this is the value of the bar as it is created; it is not the “comment” bar number which optionally starts a chord line. Unless you know, exactly, how the bars are being generated it is best to not use this option.

However, the special case option using EOF as a pseudo line number can be quite useful and robust. In this case the command is appended to the end of the current file. You can not delete an event set with BAR=EOF. You might think of this as a dynamic MMAEND (here). For a “real life” example of this option, see the qriff plugin supplied with this version of MMA .

Count
This is the easist and most used option. It sets the number of bars to process before executing the command.

ID
Set a string to use as an identifier for the AFTER event.

Remove
A active event line can be removed using this option. For example, if you have an event named “Happy” you can delete it using the command:

After Remove=Happy

Any other commands will be ignored. A warning will be printed.

Repeat
Using this option you can set an event to reoccur at a regular interval. Very simply:

After Repeat=4 Print another four bars

will display a silly message after every four bars are processed.

Anything left on the command line after processing the options is assumed to be a valid MMA command. Important: all options must be on the command line before the actual command to execute. So, this will work:

After Repeat=1 Print Testing

but this will not:

After Print Testing Repeat=1 ¡¡Wrong!!

since the “Repeat=1” is considered to be part of the command.

A number of short examples of are contained in the egs/after directory.

You can have any number of AFTER event lines. Each is checked in the order found before every line of your MMA file is processed.

Events using the COUNT and BAR options are automatically deleted once they have been used. Events created with the REPEAT option will continue to be active until they are removed with a REMOVE command.

Using the command line options -e and -r and copious PRINT statements (yes, you can use AFTER for this!) will help you determine the exact event locations.