Scope

This section describes the meaning of the 'Scope' found in the descriptions of the parameters. This concept is tied to the way the music is generated.

All the commands appearing in the program arguments (including those in format files) are inserted as pseudo-comments at the head of the ABC file to be processed. Then, the whole source is parsed. The music is generated as ABC music elements are processed, but it is not directly written to the output file. Instead, it is buffered until some event occurs. This may be either the end of a tune, the end of a page (page full, %%newpage or new tune with %%splittune - abcm2ps only), or some specific music element or command (see generation below). At this moment, if the output file was still empty, the global output parameters are written (XHTML header or PostScript global definitions), and then the buffered music is written.

Here are the possible values of 'Scope':

page

Each output page has specific information (dimensions, header/footer, ...) which needs to be known at the time a new page is opened in the output file. As the exact moment of writing the buffered music may not be known, the commands of scope page should be set near the beginning of the ABC file or at least immediately after a newpage command is issued.

tune

Commands with the scope tune have to do with the tune headers (title, composer, tempo...) and footers (lyrics after tune and notes).
They behave either globally or locally depending on their placement.

When they appear outside a tune, they apply to the tunes which are yet to be processed. The parameter values are said to be 'global'.

When they appear inside a tune, they apply locally to only this tune, the remaining tunes assume the global values again. In this case, since the exact write moment is not known, such commands should appear in the tune header or immediately after the first K:.

generation

As explained above, the generation of the music is done element by element, independently of the buffering and file output. It starts at the beginning of a tune and stops naturally at the end of this tune.
In abcm2ps, the generation may be interrupted and restarted when encountering some specific information field (T: only) or command.

The commands with a scope generation are globally applied to each generation sequence (between start and stop). In other words, when such a parameter is changed many times in a generation sequence, only the last value is used. This value remains for the next generation phases. They have the same global and local behaviour as the tune commands, i.e. when starting the generation of a new tune, all parameters have the global value.

immediate

Such commands are executed as they are found in the source file. Their effects are immediate and apply to the next music elements. Some of them may do a generation restart with abcm2ps.

voice

Commands with this scope may appear only inside tunes and apply to the current voice only. Their main scope type may be generation or immediate. There is no associated global value.

restart

This information indicates that the execution of the command with abcm2ps is preceded by a stop of the generation (see generation above).