Humdrum Extras

scaletype manpage


COMMAND

    scaletype -- Categorizes **kern data as pentatonic, hexatonic, or heptatonic.

SYNOPSIS

    scaletype [-D[-F[-p[input(s)[> output]

OPTIONS

-p Add pitch-class data to output analysis.
-D Do not include directory path in the results for the filename when analyzing multiple input files.
-F Do not include filename in results when analyzing multiple input files.

DESCRIPTION

    The scaletype command identifies the type of scale being used in simple music with no notes outside of the scale. The primary scale categories identified are 5-tone (pentatonic), 6-tone (hexatonic), and 7-tone (heptatonic). Pitch class counts less than 5 notes are labeled as toofew, and more than 7 notes are labeled as chromatic. The program is particularly useful for quickly identifying simple pentatonic melodies in large sets of songs.

EXAMPLES

    Multiple File Input

    If more than one input file is given, a list of the filenames will be given with the identified scale type. For example, here are the analyses of the first few songs collected by Helen Creighton in Nova Scotia:

       scaletyle *.krn
           nova001.krn:    hexatonic
           nova002.krn:    hexatonic
           nova003.krn:    heptatonic
           nova004.krn:    heptatonic
           nova005.krn:    pentatonic
           nova006.krn:    hexatonic
           nova007.krn:    heptatonic
           nova008.krn:    pentatonic
           nova009.krn:    pentatonic
           nova010.krn:    heptatonic
           nova011.krn:    heptatonic
           nova012.krn:    hexatonic
           ...
    If you want to count the number of songs in a set with a particular scale-type quality, you can pipe the output to the unix commands grep and wc -l:
    scaletype *.krn | grep heptatonic | wc -l
    For the set of Nova Scotia songs, the resulting count is 66, with hexatonic being 62, and pentatonic being 13.

    By default, multiple files will be listed with their full pathnames according to the input. If you do not want to see the directory in which a file is located, you can add the -D option. Also, filenames can be suppressed with the -F option

       scaletype -F *.krn 
           hexatonic
           hexatonic
           heptatonic
           heptatonic
           pentatonic
           hexatonic
           heptatonic
           pentatonic
           pentatonic
           heptatonic
           heptatonic
           ...
    The -F option is useful for counting the number of songs in each category:
        scaletype -F *.krn | sort | uniq -c | sort -nr 
          66 heptatonic
          62 hexatonic
          13 pentatonic
           8 chromatic
           3 toofew
     

    Pitch-Class Sets

    Using the -p option will add additional pitch-class information after the scale-type designation.

         scaletype -p nova001.krn
             hexatonic	C D E F G A

    The scaletype program cannot be used to identify the tonic of the scale, so the first pitch-class in the list is not necessarily the tonic note.

    Here is an example of extracting diatonic pitch-class listings for all of the Bach Well-Tempered Clavier (syntax for bash shells):

        for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
        do 
           echo wtc1 $i ==============================
           scaletype -p h://wtc/wtc1p$i.krn    # WTC1 Prelude
           scaletype -p h://wtc/wtc1f$i.krn    # WTC1 Fugue
           echo wtc2 $i =====
           scaletype -p h://wtc/wtc2p$i.krn    # WTC2 Prelude
           scaletype -p h://wtc/wtc2f$i.krn    # WTC2 Fugue
        done > wtc.txt

    More example usages of the scaletype program are available on the scaletype examples page

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

DOWNLOAD

    The compiled scaletype 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 6 Apr 2013. Click here to go to the full source-code download page.