Humdrum Extras

sample manpage


    sample -- Sample the musical texture with the given rhythmic cycle.


    sample [options[input[> output]


-r cycle Sample the music in the given rhythmic cycle.


    Sample will extract notes from the original musical texture according to the given rhythmic cycle. By default the rhythmic cycle specified with the -r option is "4" which is equivalent to extracting the sounding notes occuring on the beats in a meter such as 4/4 or 3/4.

    Here is a Bach chorale used as an example input to the sample program in the following examples.

    Here is the same chorale music, with notes sampled every quarter notes, with notes occuring off of the beat being remove:
    sample file.krn

    Sampling the musical texture at the eighth-note level:

    sample -r 8 file.krn

    A more complex rhythmic cycle for sampling:

    sample -r "4 2 8. 16" file.krn



    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


    Not very sophisticated at the moment. In the future, allow for merging of adjacent textures which derive from the same note in the original texture. Deal with cycles which do not fit the meter.


    The compiled sample 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.

    The source code for the program was last modified on 5 Dec 2000. Click here to go to the full source-code download page.