scalemogrifier - generate notes of named or arbitrary scales


  $ scalemogrifier
  c d e f g a b c'

The list of accepted lilypond note names and other elements include:

  c cis des d dis ees e f fis ges g gis aes a ais bes b   nl

Available named modes include:

  aeolian amdorian dorian hminor hunminor ionian locrian lydian
  major minor mixolydian mminor phrygian


Generates notes of arbitrary scales (subsets of the Western 12-tone chromatic system) from a specified starting note in a specified direction and so forth from other options.

The output is in lilypond absolute format. The default scale is The Major Scale, but that's easy to adjust to say C Minor:

  $ scalemogrifier --minor --flats

By default, scales loop back to the starting note. If this is not the case, suffix nl to a custom interval series:

  $ scalemogrifier --intervals=c,cis,dis,e,g,nl --length=15
  c cis dis e g gis ais b d' dis' f' fis' a' ais' c''

The output is based on the assumption that c equals 0. The output can be transposed via:

  $ scalemogrifier --mode=mixolydian --transpose=-5

Integer interval numbers can be used instead of note names or the --mode option, for example the Major Scale:

  $ scalemogrifier --intervals='2 2 1 2 2 2 1' --raw

Or to form a -P4,+P5 sequence:

  $ scalemogrifier --intervals=-5,7 --len=24

Or just plain made up:

  $ scalemogrifier --intervals=1,2,3,5,7 --dir=53 --relative --len=24

Scales can also be rendered backwards:

  $ scalemogrifier --dir=-1

Or with the interval order reversed:

  $ scalemogrifier --rev

The scale generated can be fed back into a different output scale (the direction and reverse options only apply to the --intervals option scale, not the --ois scale):

  $ scalemogrifier --intervals=c,cis,dis,e,g,nl --ois=aes,bes,ces,ees,fes \
     --len=48 --flats --rel

Practical application of the results to music theory or composition left as an exercise to the user. The output can be fed to ly-fu for playback and display, for example:

  $ ly-fu --abs -l --open $(scalemogrifier ...)
  $ ly-fu       -l --open $(scalemogrifier --relative ...)


This script currently supports the following command line switches:


Positive, the scale goes up, negative, down. Magnitudes greater than 1 multiply the interval.

--flats | --noflats

Use flats instead of sharps in the output note names. Prefix with no to disable flats, in the event an alias has set them on by default.


Displays help and exits program.

--intervals=interval list

List (comma or space delimited) of intervals (integers) or notes of the scale (lilypond note names) or nl for non-loop-back-to-start- pitch scales.

--length=positive integer

How many notes to generate in the output.


List available named scale modes and then exit. Used by ZSH compdef script.


Specify named scale mode instead of using --intervals. Available modes can be listed with the --listmodes option.

--ois=interval list

"Output interval sequence" -- the custom scale or interval set that the output will be mapped into.


"Output record separator" -- text to print between each output element. Defaults to a space character.


Emit raw pitch numbers instead of note names.


Generate relative lilypond output (default: absolute). Good fun can be had by using absolute in relative mode, or otherwise letting the chance of the lilypond algorithm take the music in unexpected directions.


Reverses the order of the intervals.

--transpose=pitch or note

Value by which to transpose the output by (integer) or to (note name).


A ZSH completion script is available in the zsh-compdef/ directory of the App::MusicTools distribution. Install this to a $fpath directory.


Reporting Bugs

If the bug is in the latest version, send a report to the author. Patches that fix problems or add new features are welcome.

Known Issues

None at this time but probably lots.


Consider to lookup interesting interval series; for example, search by the major interval sequence for numeric sequences that contain it:,2,1,2,2,2,1

Music::Canon contains routines for mapping series of pitches via arbitrary scales or interval sequences to produce new material.


Jeremy Mates


Copyright (C) 2012-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.