Humdrum Extras

thru2 manpage


COMMAND

    thru2 -- Expand repeated material in Humdrum files.

SYNOPSIS

    thru2 [-l | -i | -v variation | -r realization[-k[input[> output]

OPTIONS

    -v variation Expand the music accoring to the variation tag.
    -r realization Realize a specific sequence of labels not given in the file.
    -l Display a list of the expansion strings and labels present in the file.
    -i Display a detailed list of information about the labels present in the file.
    -k Keep variation interpretations in the processed data.

DESCRIPTION

    Thru2 emulates the behavior of the Humdrum Toolkit command thru, but fixes bugs caused by more recent awk interpreters.

    The thru command is usually used to expand repeated sections of music. For example, the following music is typically encoded as written:

    In the **kern encoding on the left below, there are two labels, *>A and *>B, which demark two sections in the music. The A section will be repeated when performed, and the B section will be played only once. Running the command:

     thru2 file.krn 
    will search for the default variation directive, which is *>[A,A,B] in this file, and generate the result on the right which contains the A section twice, and then the B section once.

    Before thru processing
    After thru processing

    When data is processed with the thru command, the marker *thru is added to the data to indicate that it has been processed. The any variation interpretations, such as *>[A,A,B] in this case, will be removed unless the -k options is used to keep them in the processed data. Using the -k option might be useful in this case, in case you want to generate the norep variation from the thru-processed default variant.

    If there is more than one way to realized the data in a file, an arbitrary tag can be added to the variation interpretation between the '>'and '[' characters. For example, the file on the left below contains the default variation *>[A,A,B], plus two other variations called norep (for "no repeating"), and reverse.

    Before thru processing
    thru -v norep
    thru -v reverse

    The thru2 command also includes three additional options: -i, -l, and -r not found in the original thru command.

    The -l option generates a single column list containing the variation strings and labels present in the file. Such as the following example:

    The -i option gives more detailed information about the labels. Variant strings are listed in global comments above the label data. There are seven columns of data:

    1. **label -- a **thru label found in the file.
    2. **sline -- the starting line of the label (offset from 1)
    3. **eline -- the ending line of the label (the line just before the next label, or if the label is the last one in the file, then the last line of the file (may be changed later to the end-of-data marker *-).
    4. **sbeat -- starting beat of the label, in terms of absolute beats starting at the beginning of the file (offset from 0 for the first beat). Beats are current defined statically as quarter notes.
    5. **ebeat -- ending beat of the label, which is the starting beat of the next label.
    6. **dur -- the ending beat minus the starting beat. This equals the total duration of the music within the scope of the label.
    7. **bar -- the number of the barline in which the label starts. If there are no barlines, then -1 will be given. If there is a pickup measure, or the first barline is not specified explicitly, then the first label will start at measure 0.

    The -r option can be used to realize a variant of the score using a label sequence which is not present in the score. For example, if you wanted to repeat the A section of the music from the above examples, there is no variant listed in the file to do that, so you can use the -r option to specify the desired sequence on the command-line:

           thru2 -r "A,A,B,B2,C,D,D2"
     

EXAMPLES

DOWNLOAD

    The compiled thru2 program can be downloaded for the following platforms:
    • Linux (i386 processors) compiled on 3 Mar 2008.
    • Windows compiled on 1 Jun 2006.

    The source code for the program was last modified on 3 Mar 2008.