It is possible to specify directly a set of notes for the harmonical to play. One way to do this is using chord input files. They allow chords, made up of clusters of points in the space, to be specified sequentially. This page describes the syntax of these files.
Note that the parser does not produce these files - it calls the harmonical directly. This input mechanism is intended only for generating examples manually.
Contents
Syntax
Comments are prefixed by #:
# This line is ignored
Global directives
The file begins with some global directives.
Directives are lines that start with a @ symbol, followed by the name of the directive, a colon and then the value:
@directive: value
These directives must include the @format directive, specifying the input format, which in this case must be chord.
@format: chord
The tempo directive specifies the tempo in beats per minute (MM):
@tempo: 80
Assignments
An assignment may be made at any time. Assignments set properties that affect the generation process. They take the form:
key = value
Origin
The origin assignment sets the pitch of the origin of the tonal space - (0,0,0).
It may be set to an absolute frequency, given as an integer:
# Tune to a 440 A origin = 440
It may also be set to the pitch of a point in the space relative to the current origin:
# Move to a C origin = (1,-1,-1)
Envelope
Assignment to envelope sets the amplitude envelope applied to the generated tones.
Possible values are:
in: fade in (triangle wave)
out: fade out (triangle wave)
inout: fade in and out
smooth: fade in and out logarithmically (more smooth)
piano: a sharp attack and then long hold - not much like a piano, but that sort of thing
Double root
Assignment to double_root, boolean on or off. If this is on, the root note in the chord will be doubled an octave below its normal pitch.
Equal temperament
Assignment to equal_temperament, boolean on or off. Usually the actual pitches of the tonal space points are generated. When ET is turned on, the pitches generated are those that would correspond to the same note name in equal temperament.
Chords
Chords may be specified in two ways.
Tones
The command tones followed by a list of 3D coordinates generates the pitches of those coordinates, played together. You may also give a number of beats to hold the chord for by adding for X to the end, where X is the number of beats. X may be given as a fraction n/d.
You may also optionally specify a volume for the chord using vol followed by an integer 0-99. By default, the chord will be played with 80% volume.
Here's a perfect cadence as an example:
# IIm7 tones (2,0,-2) (3,0,-2) (0,0,0) (3,-1,-1) for 2 # V7 tones (-1,-1,0) (0,-1,0) (1,1,-1) (-1,0,1) for 2 # IM7 tones (0,0,-1) (1,0,-1) (1,1,-1) (0,1,0) for 4 vol 99
You can also use t as an abbreviation of tones:
# IIm7 t (2,0,-2) (3,0,-2) (0,0,0) (3,-1,-1) for 2
Chord types
Alternatively, use a pre-defined chord type. The chord types are defined as a cluster of tonal space points relative to the root.
Use the chord command to select a chord type. You can add a duration and volume as with tones. By default, the chord is rooted at the origin. You can specify a root as a coordinate following at.
Here's the same cadence again:
# IIm7 chord m7 at (2,0,0) for 2 # V7 chord 7 at (1,0,0) for 2 # IM7 chord M7 at (0,0,0) for 4
Currently defined chord types are:
M7: major seven
m: minor triad
m7: minor seven
7: dominant seven
- nothing: major triad
Rests
Specify a rest with the rest command, using for to give a length, as with chords. As before, the duration may be a fraction n/d.
rest for 2
Generating
The script play.py in bin/harmonical/ will read in a chord input file and generate audio from it. By default, it will try to play it. Use the -o option to output the audio to a file.
Example
@format: chord @tempo: 80 # Tune to a 440 A origin = 440 # Move to a C origin = (1,-1,-1) envelope = smooth # Major chord: JI, then ET equal_temperament = off tones (0,0,0) (1,0,0) (0,1,0) for 4 rest for 1 equal_temperament = on tones (0,0,0) (1,0,0) (0,1,0) for 4 rest for 3 # Minor chord: JI, then ET equal_temperament = off tones (0,0,0) (1,0,0) (1,-1,0) for 4 rest for 1 equal_temperament = on tones (0,0,0) (1,0,0) (1,-1,0) for 4
Generating midi
The harmonical can also generate tuned midi files. Use the play.py script with option --midi to generate or play midi output.
The directives applicable to midi file generation are largely the same as the above. envelope will be ignored. A new directive program allows you to insert a program change event (to change the instrument). The argument should be a number 0-127. Look up your midi device's instrument list (or the General Midi instrument list) to find out what the numbers mean.