Installing Individual Humdrum Commands

This document provides quick assistance for installing individual Humdrum commands.

If you wish to install the complete Humdrum Toolkit, please refer to the full-text Installation Guide.

Click on one of the following options:

Adding a New Tool

If you have previously installed Humdrum tools on your system, then the following actions should make the tool available for use on your system:

cp $HUMDRUM/bin
cp $HUMDRUM/bin
chmod +x $HUMDRUM/bin/commandname

Note that most Humdrum commands consist of two files. The first file is the same as the name of the command (e.g. census). The second file typically adds the .awk extension.

For example, the "census" command might be installed by typing:
cp census $HUMDRUM/bin
cp census.awk $HUMDRUM/bin
chmod +x $HUMDRUM/bin/census

First Time Installation

Indicate which operation system you are using:

IMPORTANCE NOTICE: PLEASE READ THIS INSTALLATION GUIDE CAREFULLY BEFORE YOU BEGIN. Since this software is not a commercial product, no user support is available. Your comments and suggestions are welcome, although we cannot guarantee that your correspondence will be answered. This Installation Guide and the associated documentation are your principal sources of information.

The Humdrum tools were designed to work under the UNIX operating system. The Humdrum tools will also work under Windows 95/98/NT, DOS or OS/2 environments provided the user has access to UNIX utilities for DOS or OS/2. In all systems, the Humdrum tools must be invoked using the Kornshell or Bourne shell command interpreters. Under LINUX the compatible Bash shell interpreter can be used provided the shell getopts function is available. The Humdrum Tools can also be run under the C-shell (csh) or TC-shell (tsch) with some modifications.

What You Need

UNIX Users:
If you are using UNIX, you need the following:
(1)At least 5 megabytes of free disk space
(2)AWK (1985 revision) -- also known as nawk, gawk
(3)Either the Kornshell or Bourne shell command interpreter
Windows 95/98/NT, Windows 3.X, DOS Users:
If you are using DOS, you need the following:
(1)An IBM-PC or PC-compatible computer
(2)At least 5 megabytes of free disk space
(3)At least 512 kilobytes of internal memory
(4)DOS operating system; version 2.1 or later
(5)UNIX utilities for DOS, including AWK and Kornshell§
(6)Roland MPU-401 or compatible MIDI card (optional)
§ These utilities are available from Mortice Kern Systems.
Macintosh Classic, Quadra, Power Macs, Powerbook, G3 Users:
If you are using Apple System 7, you need the following:
(1)An Apple computer or compatible clone
(2)At least 5 megabytes of free disk space
(3)At least 512 kilobytes of internal memory
(4)System 7 or later operating system
(5)UNIX utilities for Apple systems, including AWK and Kornshell§
§ These utilities are available from Tenon Intersystems.

Installation Preliminaries

The Humdrum tools are designed for use with UNIX, Windows 95/98/NT, DOS, or OS/2 environments. However, there are some differences of implementation between these systems that affect the configuration and performance. On UNIX systems, the Humdrum tools pertaining to MIDI input and output are currently unavailable. On Windows NT, Windows 95/98, Windows 3.X, DOS and OS/2 systems the Humdrum Toolkit is able to work only if the software has access to crucial UNIX utilities not provided with the toolkit. In particular, the Humdrum tools will not work under Windows, DOS or OS/2 without access to the AWK pattern-action language and the Kornshell or Bourne shell command interpreters. Several versions of both AWK and ksh are available for Windows 95/98/NT, DOS and OS/2. Both commercial software and freeware are available. Reliable versions of the necessary utilities are available in the MKS Toolkit manufactured by Mortice Kern Systems, AT&T's UWIN utilities, Microsoft's Interix, and GNU's cygwin, These, or comparable UNIX utilities, must be installed on your Windows 95/98/NT, DOS or OS/2 system before the Humdrum Toolkit can be successfully installed. The Humdrum installation procedure itself makes use of various UNIX utilities.

Presuming that you have installed the "MKS Toolkit," "UWIN", "Interix", or "cygwin", on your Windows 95/98/NT, DOS or OS/2 system, you can continue with the Humdrum installation.

You may install the Humdrum Toolkit by using the automatic installation program -- install -- provided with Humdrum.

Installation on Windows NT, Windows 95/98, Windows 3.X, DOS or OS/2

Before you begin installation, you need to carry out a few preliminary tasks.

Having successfully completed these preliminaries, you are ready to begin installation.

In order to confirm that your Humdrum Toolkit has been successfully installed, type the humver command. This command will simply echo the version of the toolkit currently installed. The Humdrum tools should be ready for use.

If you intend to make use of the Humdrum MIDI tools, refer to the MIDI Configuration section of this installation guide.

Installation on UNIX

Before you begin installation, you need to carry out a few preliminary tasks. Not all UNIX systems are equipped with a floppy disk drive. It may be necessary to copy the entire contents of the distribution disks in raw form into a temporary directory on your UNIX userid. This may be done via uucp, ftp, tar, procom, kermit, or some other file-transfer utility. (Refer to the UNIX reference manual for your facility.) Copy the contents of all of the distribution disks into a single directory. Note that most of the files are in compressed form.

Having successfully completed these preliminaries, you are ready to begin installation.

In order to confirm that your Humdrum Toolkit has been successfully installed, type the humver command. This command will simply echo the version of the toolkit currently installed. The Humdrum tools should be ready for use.

Additional Information for UNIX Users

Some transfer programs -- such as ftp -- will preserve carriage returns as a carriage-return/line-feed combination, rather than transforming them into simple line-feeds expected by UNIX. You may encounter problems with control-M characters (^M) inserted at the end of each record for all of your Humdrum files. These characters must be eliminated in order for the Humdrum tools to be operational. If you are an experienced UNIX user, you can use the sed stream-editor to eliminate all control-M characters. Execute the sed script:

sed 's/^V^M//' inputfile > outputfile

for each file -- remembering to rename the output file as the input file. (The string "^V^M" represents control-V followed by control-M.) If you are not an experienced UNIX user, you may want to seek the assistance of a local UNIX expert or consultant.

While it is possible to distribute executable files (.exe) for Windows 95/98/NT, DOS and OS/2 systems, the variety of UNIX platforms precludes distributing executable files for various C programs. Consequently, UNIX users must compile a handful of programs so that they will work on your specific machine. Five programs are involved: assemble, humdrum_, midi, rid, and simil. These programs can be compiled by (1) changing directory to each of the source-code subdirectories for each of these tools (i.e. csource), and (2) executing the make command for each tool. Simply type the command:


-- once in each of the five subdirectories. Once you have made an executable file, move it to your main Humdrum directory ($HUMDRUM/bin) -- using the UNIX mv command. This will ensure that these programs reside in your PATH. Finally, use the UNIX

chmod a+x *

command to ensure that all files in the $HUMDRUM/bin directory are executable.

Note that since there is no standard MIDI interface for UNIX systems, the Humdrum MIDI input and output tools cannot be used on UNIX. These tools include encode, record, smf, and tacet. Version 2.0 of the "perform" command can be installed and configured on Linux systems.

Installation on Apple Systems Using MachTEN

Since Apple computer systems do not provide basic UNIX utilities, the Humdrum Toolkit cannot be run on native Apple systems.

However, the Humdrum Toolkit can be installed if users purchase a commercial set of UNIX utilities for Apple Systems. Tenon Intersystems distributes a suitable product called MachTEN. A review of the MachTEN software (including a comparison with A/UX) was published in Advanced Systems Magazine (formerly Sun World Magazine).

Assuming that MachTEN or similar software has been installed, users should follow the instructions given for UNIX installation of the Humdrum Toolkit.

MIDI Configuration

The Humdrum MIDI tools can be used on Windows 95/98/NT, DOS and OS/2 systems provided the computer is fitted with a Roland MPU-401 or compatible MIDI card. The Humdrum MIDI tools are not currently available under UNIX. Note that the MIDI software tools support only the following interrupts: 2/9, 3, 5, and 7. Interrupts 10, 11, and 12 will not work. If necessary, refer to the manufacturer's hardware manual for details concerning how to change interrupt settings on your MIDI board.

When using Microsoft Windows, the Humdrum MIDI tools are able to access the MIDI card only if Windows is invoked in "standard mode" rather than "386 enhanced mode." From the DOS prompt type:

win /s

and select the MKS Kornshell icon. Once in the Kornshell, be sure that your profile.ksh has been executed. If not, type the command

. /etc/profile.ksh

Quick-Start Tutorial

Having installed the Humdrum Toolkit, you will be eager to see Humdrum in action. Begin by changing directories to the Humdrum demonstration directory. This is located in the subdirectory demo under the directory where you installed Humdrum. In most cases, you can change directories by typing the command:

cd /humdrum/demo

This directory holds a number of tutorial files, and also includes a subdirectory containing a selection of musical scores encoded in various Humdrum formats.

Begin by typing:


This demonstration will first ask you whether you have an appropriate MIDI set-up (see MIDI Configuration). Answer `yes' only if your system runs Windows 95/98/NT, DOS or OS/2 and has a Roland MPU-401-compatible MIDI card with a MIDI synthesizer connected for sound output. (Answering `no' will restrict the demonstration to outputs that don't involve sound.)

The Humdrum demo will provide a menu of ten sample problems. Each problem will pose and answer some analytic question in real-time. (On older machines, some of the sample calculations may take several minutes to execute.) You can stop the demo at any time by typing one or more control-Cs.

If your system is configured for MIDI output, you might also try changing directories to the scores subdirectory and playing one of the scores. A MIDI version of the first movement of Haydn's string quartet Opus 76, No. 3, is encoded in the file haydn76.hmd.

Begin by typing the command:

perform misc/haydn76.hmd

If your MIDI system is properly configured, you should hear a deadpan performance of the work. Try typing various numbers followed by . This will move the performance immediately to the corresponding numbered measure. (If you enter a number greater than the total number of measures, playback will terminate.) Type plus (+) or minus (-) to move ahead or backward one measure at a time. Press the space-bar to interrupt play. Also try typing `<' and `>' to slow-down or speed-up the tempo. (Notice that you don't have to use the shift-key when typing `<', `>' or `+'.) You might also want to explore the search commands. Try typing a slash (/) followed by the word `Development', followed by . To search backward from the current score position, use the question mark (?) rather than the slash -- as in `?Exposition' . To end, type the escape key . If your MIDI instrument continues to sound after the perform program has ended, type:


This will turn-off any sounding tones.

You may want to view the accompanying videocassette in order to further familiarize yourself with the capabilities of the Humdrum Toolkit. Ultimately, you will need to begin reading the Humdrum Users' Guide and start working through the tutorial exercises. As with the study of a musical instrument, practice is essential to developing a skill.


Some users may be interested in gaining a basic understanding how the Humdrum tools work. The following description provides a general outline of the operation of the Humdrum tools.

The Humdrum tools were developed with several criteria in mind. The foremost criterion was that the tools needed to be easy to program. Most of the tools are written in the AWK programming language -- a "fast prototyping language" whose syntax is very similar to that of the C programming language. AWK was developed by Alfred Aho, Brian Kernighan, and Peter Weinberger (hence the name AWK). AWK is especially well suited to musical applications since AWK provides extensive, yet simple-to-use facilities for matching and manipulating strings patterns.

Since AWK is an interpreted language, AWK programs must invoke the AWK interpreter each time they are executed. The command-line syntax for invoking AWK programs is cumbersome. In order to simplify the command-line syntax, special-purpose "shell scripts" have been used to massage the command invocation, to parse the options, and to provide help screens where appropriate.

Most Humdrum commands cause a shell-script to be executed. Each script invokes the AWK interpreter and calls the appropriate AWK program. The shell-scripts were written in the well-known UNIX Kornshell. On Windows 95/98/NT, DOS and OS/2 these scripts are held in files designated by the .ksh extension. These scripts can also be executed from the Bourne shell, but they are not compatible with the UNIX C shell.

A typical Humdrum command, such as the kern command, is associated with two files: kern.ksh (or just kern on UNIX) and kern.awk. The .awk script acts as both the "source" code and the "executable" code. Both .ksh and .awk files are ordinary ASCII files, and so can be examined and (potentially) modified by the user.

Some more complicated Humdrum commands have been partitioned into several subprograms. For example, the Humdrum extract command consists of four separate programs, extract1.awk, extract2.awk, and so on. The associated shell script (extract.ksh) determines which of the extract programs should be invoked, on the basis of the user-selected options.

More computationally intensive programs have been written in the C programming language. These include Humdrum commands such as perform and simil. On Windows 95/98/NT, DOS, the perform.exe, simil.exe, ... files are executable files, compiled from C programs. The Humdrum distribution disks include the complete source code (.c files) for all of these commands.

In order to be able to execute Humdrum commands, several conditions need to be satisfied. First, either the Kornshell or Bourne shell command interpreter must be available. Second, the AWK language interpreter must be available. Third, four pieces of information must be accessible to the shell: (1) the shell must know where to find the Humdrum commands, (2) it must know where to find the AWK interpreter, (3) it must know where it can store temporary files, and (4) it must be told where to direct standard error outputs (on UNIX normally /dev/tty; on Windows 95/98/NT, DOS this is con. Each of these four pieces of information need to be stored in shell "environment" variables. The variables are named PATH, AWK_VER, TMP, and CON.

When you boot your system, these variables need to be assigned properly, otherwise the installed Humdrum tools will fail to work.

Trouble-Shooting Tips

The table below lists some common errors associated with faulty or incomplete installation of the Humdrum Toolkit. Further information is available to help with trouble-shooting. .cs I 18

ErrorPossible cause
Bad command or file nameKornshell has not been installed or PATH
has not been properly set.
glob: EXEC errorInstall invoked from Windows without
opening a shell.
not foundPATH not set correctly or command has
not been copied into the Humdrum directory.
: -f: not foundAWK_VER shell variable not set.
: awk: not found"awk" not in current PATH (DOS/OS2).
: nawk: not found"nawk" not in current PATH (UNIX).
awk: script file "<progname.awk>":HUMDRUM shell variable not set, or PATH
no such file or directorynot set correctly.
_main: memory allocation failureInput file(s) too big to handle; try breaking
the input into smaller segments (using
`yank'), and process each segment separately.
Assemble back together by using `cat'.
pc: compiler error ...Humdrum `pc' command conflicts with a
Pascal language compiler named `pc'.
Rename Humdrum `pc.ksh' and `pc.awk' files.

Copyright © 1993, 1999 David Huron