atonal-util - routines for atonal composition and analysis
Prime form and APIC vector for a pitch set:
$ atonal-util basic --ly f fis c
Apply a series of transformations to a pitch set:
$ cat rules retrograde invert 6 transpose 1 $ atonal-util recipe --file=rules 0 11 3 4,8,7
Among many other options.
Routines for atonal music composition and analysis, plus other music theory or composition related tasks. Global options and a mode must be supplied, followed by any mode specific arguments. Most modes accept pitch sets, though some perform other tasks and thus expect various input formats. Pitch sets can be read as arguments or from standard input; some modes require two pitch sets that must be supplied one per line on standard input.
The output will vary depending on the mode, and may include Cope tension numbers (average, min, max tension for the pitch set). Other programs should not be written to use this program, as the output may change. Use the underlying code or modules called by this program, as this program is intended for interactive use.
This program currently supports the following global command line switches:
Uses flats instead of sharps in output (but only with --ly). Specify --noflats to disable flats, in the event you have an alias that sets --flats by default. There is currently no --sharps option, sorry.
Doubleflats or doublesharps are not supported in the output, as they will be rendered to the underlying note (e.g. for Fx the output would be G). Doubleflats or doublesharps can be specified in the input, though.
Fx
G
Displays help and exits the program.
Displays supported operation modes and exits the program.
Show lilypond note names instead of raw pitch numbers. This feature may be disabled if the scale degrees is altered from 12.
Adjust the number of scale degrees (default: 12). May cause strange, untested results from various calculations, use with caution. Rhythm work might benefit from setting this to 16, depending.
Most modes accept a pitch set. These comprise raw pitch numbers (integers), or lilypond note names (bis, c, des, etc.), or a Forte Number, specified either on the command line or via standard input, though some modes have other conventions or input they accept.
atonal-util basic 0 4 7 10 atonal-util basic c e g bes atonal-util basic 4-27
Various global flags (listed above) can be specified as options to modes where they make sense.
Coverts the given pitches or note names into Bark scale numbers, by way of pitch2freq. Supports the same arguments as pitch2freq.
See "Voice Leading" by David Huron for practical uses of critical bands.
Shows the prime_form and interval_class_content and perhaps other details.
Converts rhythmic beats to a "pitch" set, where x represents an onset, and . a rest. An example may help:
x
.
$ atonal-util beats2set --scaledegrees=16 x..x ..x. ..x. x... 0,3,6,10,12
set2beats performs the reverse operation of this.
All permutations by rotation of the input pitch set. See Music::AtonalUtil for details.
Shows the combination tones of the input frequencies (or with the optional --pitches flag, MIDI pitch numbers or lilypond note names) relative to the first listed frequency. The delta of equal temperament tuning from the actual combination tone is also shown.
$ atonal-util --ly combos 220 440 $ atonal-util --ly combos --pitches "c' g'"
https://en.wikipedia.org/wiki/Combination_tone
This mode also accepts the --concertfreq or --cf argument to specify a different reference pitch than 440 Hz. This will affect both notes input (different frequencies) and output (how error amounts for how far the resulting combination tone is from the nearest pitch).
Emits those pitches not listed in the input. See Music::AtonalUtil.
Lists equivalents of the input pitch set under various transposition and inverse transposition operations.
Find all Forte pitch sets in which the given pitches exist. Like findin, except iterates over all Forte pitch sets instead of just a named pitch set.
With --exclude, omits results containing the listed pitches. With --fn, limits the search to the mentioned forte number prefixes (the number of pitches in the set). With --root, limits matches to those with the named root pitch.
$ atonal-util findall --root=c --fn=4-5 c e g bes
Answers questions such as, given a base pitch set of [0,3,7], and the notes D and Bb, what pitch sets (via any transpose or transpose_invert operation) complete the base pitch set. With --exclude, omits results containing the listed pitches. With --root, limits matches to those with the named root pitch.
[0,3,7]
$ atonal-util findin --exclude=c,ees --pitchset=5-25 d fis a
Returns a list of all Forte Numbers and corresponding pitch sets (and their interval_class_content). With the --tension flag, also shows Cope tension values for the pitch sets.
Given a Forte Number, returns the corresponding pitch set.
Converts the listed frequencies (in Hz) into the closest MIDI note numbers. Reads frequencies line-per-line from standard input if the only frequency given is a -. With --ly also converts the MIDI note number to a lilypond note name.
-
This mode also accepts the --concertfreq or --cf argument to specify a different reference pitch than 440 Hz.
Generates a random melody perhaps suitable for subsequent atonal use. See code and documentation over in Music::AtonalUtil for details.
Shows the "more normal" or "half prime" form of a pitch set, which may or may not differ from the prime_form of the pitch set. This output, if relevant, is also emitted in the basic mode.
See Music::AtonalUtil, or https://en.wikipedia.org/wiki/Interval_vector
Converts a list of intervals to a pitch set. The default starting pitch is 0.
Invariance under Transpose(N)Inversion operation matrix. See Music::AtonalUtil.
Returns list of transpose or transpose_invert operations that have invariant pitches with the supplied pitch set, along with which pitches have not varied.
See Music::AtonalUtil. Default axis is around pitch 0.
Converts lilypond note names to pitch numbers, via absolute mode by default. The input unlike in other modes may be quoted to protect the lilypond ' register change from shell quoting rules. Example usages:
'
$ echo c e g | atonal-util ly2pitch - $ atonal-util ly2pitch "c d' e f, g" $ atonal-util ly2pitch --relative=a\' a c d b
Converts lilypond note names and durations to C struct members comprised of the frequency in Hz and duration in milliseconds of the note. Handy for feeding data to an Arduino tone() call:
tone()
atonal-util ly2struct --relative=c\' --tempo=116 \ "c8 d e f8. g32 f e8 a d, g8. a16 g f ..."
And then:
struct voice { unsigned int freq; unsigned long dur; }; struct voice melody[] = { { 262, 259 }, /* c8 */ { 294, 259 }, /* d */ { 330, 259 }, /* e */ { 349, 388 }, /* f8. */ { 392, 65 }, /* g32 */ { 349, 65 }, /* f */ ... }; for (i = 0; i < sizeof(melody) / sizeof(voice); i++){ if (melody[i].freq != 0) tone(BUZZER_PIN, melody[i].freq); delay(melody[i].dur); noTone(BUZZER_PIN); }
Other (less tested) options include --beats (quarter note by default), --concertfrequency and --concertpitch, and a --scala file to use.
Multiplies specified pitches by specified factor (1 by default).
1
Returns the normal form (via the "packed from the right" method) of the given pitch set.
Converts note durations (for example 4 for a quarter note or 4. for a dotted quarter note, or 8..*2/3 for a double-dotted eighth note of a triplet) to time, which is shown in a condensed form, unless -- ms is supplied, in which case the duration is shown in milliseconds. The --fraction=x/y option provides another means to set fractional durations, and is applied to all durations provided.
4
4.
8..*2/3
See also time2notes, which reverses millisecond values.
Given a pitch set, returns the corresponding Forte Number, if any.
Given a pitch set of at least two elements, returns the list of intervals between the pitches.
Converts pitches to frequencies (in Hz) using the standard MIDI note number conversion equation. Reads pitches (or lilypond notes) line-by-line from standard input if the only pitch given is -.
Return the interval class a given pitch belongs to.
Converts pitches (integers) to lilypond note names. Reads pitches line-by- line from standard input if only pitch given is -. Use the --mode option to specify relative or absolute conversion.
Returns the prime form of the given pitch set.
Apply a series of named operations from a batch file to a given pitch set. One possibility for recipefile contents might be:
recipefile
retrograde invert 6 transpose 1
Reverses the given list of pitches.
Rotates the pitch set by the given integer (by default 0 or no rotation). Music::AtonalUtil also has a rotateby method to rotate to a particular element that may be of use in composition.
0
Converts a set class into a list of rhythmic beats. Reverse of what beats2set does.
$ atonal-util set2beats 4-27 x.x..x..x...
Far more interesting might be to listen to the set:
$ atonal-util set2beats 5-z38 | \ perl -pe 'tr/x./cr/; s/(.)/${1}16 /g' | \ ly-fu --tempo=168 --repeats=16 -
Computes the set complex of a pitch set (a table of the pitch set, pitch set inversion, and their combination).
See Music::AtonalUtil. The length, if supplied, must be a magnitude equal to or less than the number of pitches supplied, and probably also two or higher.
Transposition common-tone structure. See Music::AtonalUtil. Probably easier to use the invariants mode to list the full results.
As above method except with transpose_invert instead of transpose. Probably easier to use the invariants mode to list the full results.
Returns the average, min, max, and tension values for all the tensions in the passed pitch set, from the first notes in the set up to the last. Tensions calculated via Music::Tension::Cope.
Converts millisecond values to note durations. Reverse of notes2time with the --ms flag. These two can be used to convert notes between different tempos, for example to effect a fermata delay where tempo changes in the MIDI are not possible:
IN_T=39 OUT_T=60 atonal-util time2notes --tempo=$OUT_T \ $(atonal-util notes2time --ms --tempo=$IN_T c4)
This would convert a quarter note at a tempo of 39 to the equivalent under the tempo of 60. The output value presently uses the lilypond multiplier format to represent the new duration.
lilypond
Transposes the supplied pitches by the specified integer (by default 0, or a no-op), or to the specified note.
$ atonal-util transpose --transpose=4 --ly c e g e gis b $ atonal-util transpose --transpose=e --ly c e g e gis b
Register aware transpositions are possible with the canonical tool of the App::MusicTools module, among many other nifty features (modal transpositions, etc).
canonical
Inverts and then transposes the supplied pitch set by the specified integer, or to the specified note. Default axis for inversion is 0 (c).
Accepts two pitch sets, one per line, via standard input. Returns three lines consisting of the intersection, difference, and union of the given sets.
Given a list of pitches or notes, shows what scales, if any, fit those notes. Only diatonics of the scale are considered; there is no support at present for also matching on bVI or other common chromatic alterations.
Accepts two pitch sets, one per line, via standard input. Emits 1 if the two sets share the same interval_class_content, 0 if they do not.
A ZSH completion script is available in the zsh-compdef/ directory of the App::MusicTools distribution. Install this to a $fpath directory.
zsh-compdef/
$fpath
If the bug is in the latest version, send a report to the author. Patches that fix problems or add new features are welcome.
http://github.com/thrig/App-MusicTools
Poor naming conventions and standards of underlying music theory and any associated mistakes in understanding thereof by the author. (The Forte numbers are the Rahn Forte numbers, not the Forte Forte numbers.)
http://en.wikipedia.org/wiki/List_of_pitch_class_sets
Music::AtonalUtil, Music::LilyPondUtil, Music::Tension::Cope
Jeremy Mates
Copyright (C) 2012-2015 by Jeremy Mates
This module is free software; you can redistribute it and/or modify it under the Artistic License (2.0).
To install App::MusicTools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MusicTools
CPAN shell
perl -MCPAN -e shell install App::MusicTools
For more information on module installation, please visit the detailed CPAN module installation guide.