canonical - compute canon voices via the Music::Canon module
$ canonical --contrary --retrograde exact c cis d $ canonical --transpose=12 exact c e g $ canonical --raw --contrary exact 1 2 3 $ canonical modal --input=lydian --output=locrian c e g
Command line interface to mapping methods present in the Music::Canon module. Custom questions might be better answered by coding directly against Music::Canon, see the eg/ directory under the distribution of that Perl module for examples.
eg/
A major difference between this utility and Music::Canon is that the module assumes contrary motion and retrograde by default, while this utility does no.
This script currently supports the following global command line switches. These can also be specified to each of the underlying modes.
Whether to compute output line in contrary motion or not.
Print notes with flats instead of sharps.
Emit some help information and exit.
Whether to emit output in raw pitch numbers or lilypond note names.
Use relative mode in Music::LilyPondUtil and make the input notes relative to the specified note. Without this option, the assumption is that the lilypond input is specified in absolute form:
g d\' # MIDI pitches 55 62 (absolute) --relative=g\' g d\' # MIDI pitches 67 74 (relative to g' or 67)
Whether to reverse the output phrase or not.
Transpose to the first note of the output phrase by the specified amount in semitones (integer) or to the specified lilypond note name.
Exact interval canon computation. No new options beyond the global ones listed above.
$ canonical exact --transpose=e c e g
Modal interval canon computation. In addition to the global options listed above, accepts:
Sets the output mode starting pitch via set_modal_pitches. Probably should also be called with --startpitch. Very necessary if the phrase begins on a non-tonic scale degree.
Scale name (see Music::Scales) or Forte Number to use for the input. A colon delimits the ascending versus descending data; commas delimit specific scale degrees. Examples:
--input=mm --input=major:minor --input=2,2,2,2,1:5-25
See Music::Canon for the algorithm that maps input to output mode.
Allow non-octave scales. Necessary if the scale intervals sum up to more than 12, or if scales must repeat before the usual 12-pitch octave point.
Like --input, except for the output line.
Sets the input mode starting pitch via set_modal_pitches. Probably should also be called with --endpitch. Very necessary if the phrase begins on a non-tonic scale degree.
String to use for notes or pitches that cannot be converted. If unset, defaults to x. For example, under contrary motion, using Major to Major scales, C to D via C sharp is impossible, as there is no space between C and B downwards in the output line for the chromatic C sharp:
x
$ canonical --relative=c modal --contrary --undef=OOPS c cis d c OOPS b
Set this to r or s to have lilypond or ly-fu ignore the impossible note.
r
s
lilypond
ly-fu
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
http://www.lilypond.org/ and in particular the Learning and Notation manuals should be consulted to understand lilypond note syntax. Or, use raw pitch numbers.
http://en.wikipedia.org/wiki/Forte_number
Music::Canon, Music::LilyPondUtil, Music::Scales
Jeremy Mates
Copyright (C) 2013 by Jeremy Mates
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16 or, at your option, any later version of Perl 5 you may have available.
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.