Humdrum Extras

thrux manpage


    thrux -- Expand repeated material in Humdrum files.


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


-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.


    Thrux emulates the behavior of the Humdrum Toolkit command thru, but fixes bugs caused by more recent awk interpreters, adds some more options, and allows for labeled sections other than the last one to end the output (such as for menuet & trios).

    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:

     thrux 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, if 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 thrux 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:

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



    Input arguments or piped data which are expected to be Humdrum files can also be web addresses. For example, if a program can process files like this:
           program file.krn
    It can also read the data over the web:
    Piped data works in a somewhat similar manner:
           cat file.krn | program
    is equivalent to a web file using ths form:
           echo | program

    Besides the http:// protocol, there is another special resource indicator prefix called humdrum:// which downloads data from the kernscores website. For example, using the URI humdrum://brandenburg/bwv1046a.krn:

          program humdrum://brandenburg/bwv1046a.krn
    will download the URL:
    Which is found in the Musedata Bach Brandenburg Concerto collection.

    This online-access of Humdrum data can also interface with the classical Humdrum Toolkit commands by using humcat to download the data from the kernscores website. For example, try the command pipeline:

          humcat humdrum://brandenburg/bwv1046a.krn | census -k


    The compiled thrux program can be downloaded for the following platforms:
    • Linux (i386 processors) (dynamically linked) compiled on 28 Jun 2012.
    • Windows compiled on 29 Jun 2012.
    • Mac OS X/i386 compiled on 13 Nov 2013.
    • Mac OS X/PowerPC (version 10.2 and higher) compiled on 13 May 2009.

    The source code for the program was last modified on 9 Apr 2013. Click here to go to the full source-code download page.