Humdrum Extras

location manpage


COMMAND

    location -- List musical/file location of each data line.

SYNOPSIS

    location -flmbapdLQRS [-x|-q|-h|-w[input(s)[> output]

OPTIONS

-a Append location as last spine.
-b Display beat position within a measure.
-d Double label markers so that they appear before and after location information.
-e Display duration since start of music in eighth notes.
-f Display filename as part of location information.
-h Display duration since start of music in half notes.
-l Display current file (segment) line as part of location information.
-L Do not display label markers.
-m Display measure of current data line.
-p Prepend location information as first spine.
-q Display duration since start of music in quarter notes.
-Q Do not display quotes around filename.
-R Display musical locations as rational numbers instead of floats.
-S Don't put a space between each location information field.
-w Display duration since start of music in whole notes.
-x Display duration since start of music in sixteenth notes.

DESCRIPTION

    The location program generates an analysis spine which encodes the position of each data line in the file and/or musical score. By default, a single spine with all location features is output. The main use of this location data is to mark the original location of data when searching for patterns with grep. The hgrep program has similar funcionality built into itself for identifying the location of matched patterns in a data file.

    example.krn
    location example.krn

    The full location information is:

    1. Filename enclose in double quotes.
    2. Line number, prefixed by capital "L".
    3. Measure number, prefixed by capital "M".
    4. Beat number, prefixed by capital "B".
    5. Absolute quarter note position. (time from start of music until current line), prefixed by capital "Q".

    Each of these features can be selectively extracted from the score. When none of the location features are given as an option, all of them are extracted.

    1. -f include the filename in the **location spine.
    2. -l include the original file line number in the **location spine.
    3. -m include the measure number in the **location spine.
    4. -b include the metric beat position in the **location spine.
    5. -q include the absolute quarter note position in the **location spine.

    The location prefix markers can be duplicated after each feature in order to make regular expression more robust by using the -d option to double the labels. This helps to avoid matching cases such as M11 when searching for M1:

    example.krn
    location -d example.krn

    Label prefixes can be removed with the -L option:

    example.krn
    location -L example.krn

    Spaces between the features can be removed with the -S option:

    example.krn
    location -S example.krn

    The -a option will append the **location spine to the input data, while -p will prepend the analysis data to the input data.

    location -p example.krn
    location -a example.krn

    The filename quotes can be removed by using the -Q option.

    location -Qa example.krn

    Alternate absolute position descriptions

    In addition to -q for absolute quarter note rhythmic positions of data lines, several other rhythmic values can be used:
    • -x: express absolute position in terms of sixteenth notes.
    • -e: express absolute position in terms of eighth notes.
    • -q: express absolute position in terms of quarter notes.
    • -h: express absolute position in terms of half notes.
    • -w: express absolute position in terms of whole notes.

    example.krn
    location -xmb
       -emb
       -qmb
       -hmb
       -wmb

    Rational numbers for rhythms

    The -R option can be used to list rhythmic values as rational numbers instread of floating point:

    location -mba | location -Rmba

EXAMPLES

    Locate French augmented-sixth chord sonorities in Bach chorales

     tntype -Da h://chorales | location -Qafmb | dittox -p | grep -i French
     
     8FnJ	8BJ	8d#J	(4a)	French-sixth Chord	chor146.krn M4 B2.5
     
    A French sixth sonority occurs once in Chorale 146 at measure 4 on the offbeat of beat 2.

    Compare to using hgrep:

     tntype -Da h://chorales  | hgrep -NHmb -x '**description' French
     
     chor146.krn:measure 4:beat 2.5:FnJ	8BJ	8d#J	(4a)	French-sixth Chord
     

ONLINE DATA

    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:
           program http://www.some-computer.com/some-directory/file.krn
    Piped data works in a somewhat similar manner:
           cat file.krn | program
    is equivalent to a web file using ths form:
           echo http://www.some-computer.com/some-directory/file.krn | 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

SEE ALSO

DOWNLOAD

    The compiled location program can be downloaded for the following platforms:
    • Linux (i386 processors) (dynamically linked) compiled on 24 Oct 2013.
    • Mac OS X/i386 compiled on 13 Nov 2013.

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