Roots and Scales

Changing the Root

To change the root (or key) of the music in FoxDot, simply change the value of the Root.default variable:

Root.default = 2

When you start FoxDot, it is automatically set to 0, which is the key of C. Setting the Root.default value to a number indicates how many semitones to move the root. So to make music in the key of D, you would set the value to 2. This value can be an integer, a floating point value, a TimeVar, or a string. You can use a string to explicitly set the key like so:

Root.default = "D"

You can specify sharps and flats using the “#” and “b” characters respectively:

Root.default = "D#"
Root.default = "Db"

You can set the root of a Player object explicitly using the root keyword. Note: this cannot be a string.

# Force player into key of D
p1 >> pluck([0, 2, 4], root=2)

# Will raise an error
p1 >> pluck([0, 2, 4], root="D")

Updating the Scale

When starting FoxDot the scale is automatically set to the major scale. To view all of the available builtin scales, run the following:


This will return a list that looks similar to this:

['aeolian', 'altered', 'bebopDom', 'bebopDorian', 'bebopMaj', 'bebopMelMin', 'blues', 'chinese', 'chromatic', 'custom', 'default', 'diminished', 'dorian', 'dorian2', 'egyptian', 'freq', 'halfDim', 'halfWhole', 'harmonicMajor', 'harmonicMinor', 'hungarianMinor', 'indian', 'justMajor', 'justMinor', 'locrian', 'locrianMajor', 'lydian', 'lydianAug', 'lydianDom', 'lydianMinor', 'major', 'majorPentatonic', 'melMin5th', 'melodicMajor', 'melodicMinor', 'minMaj', 'minor', 'minorPentatonic', 'mixolydian', 'phrygian', 'prometheus', 'romanianMinor', 'susb9', 'wholeHalf', 'wholeTone', 'yu', 'zhi']

To view the semitones used by a particular scale, e.g. locrian, you can run print(Scale.locrian), which will return a Pattern object. Similar to setting the root, you can update scale by changing the Scale.default value. This can be the name of the scale as a string, the scale object e.g. Scale.locrian, or a Pattern of semitone values to use.

Scale.default = "minor"
Scale.default = Scale.minor
Scale.default = P[0, 2, 3, 5, 7, 8, 10]


You can also set the tuning of the scale by using Scale.default.set() instead and supply a tuning keyword argument. The currently available tuning types are as follows:

FoxDot SyntaxDescription
Tuning.ET1212-tone equal tempered (default)
Tuning.justJust intonation
Tuning.bohlen_pierceBohlen Pierce Scale
Scale.default.set("major", tuning=Tuning.just)

As mentioned, to use a different tuning type you need to use .set() with the default scale:


You can create your own tuning system using the TuningType object, which takes a list of numbers that divide the scale up such that the equal tempered 12 tone tuning system would use the numbers [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].

Scale.default.set("major", tuning=TuningType([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])