This module is a IIFE (Immediately Invoked Function Expression) and
it returns a var with the name of scaleDegree. This document contains its public API.
This module uses the jazz method of describing a major scale: 1 2 3 4 5 6 7 8
and it uses # and b as modifiers. They must be a string (not numbers) so that
sharps (#) or flats (b) can be used to modify
i.e. '1 b2 b3 4 5 b6 b7 8' represents a phrygian scale.
These patterns can be transposed to any starting location with a MIDI number offset.
The output of this library can be used with Tone.js to play notes and chords.
object:
scaleDegree object
<script src="scaleDegree.js"></script>
...
var myChordProg = scaleDegree.makeII_V_I_Major("A4")
var myBassline = scaleDegree.makeII_V_I_Major_WalkBass("A4")
these can be used with Tone.js
this function creates a II-V-I voicing in major
object:
array used with Tone.js to play chord progression
this function creates a II-V-I voicing in minor
object:
array used with Tone.js to play chord progression
this function creates a II-V-I voicing array in major
(string)
string:
array of
[name, root, voicing]
for each of the II V and I chords
this function creates a II-V-I voicing array in major
(string)
string:
array of
[name, root, voicing]
for each of the II V and I chords
this function creates a II-V-I voicing array in major
(string)
string:
array of
[name, root, voicing]
for each of the II V and I chords
this function creates a II-V-I voicing array in minor
(string)
string:
array of
[name, root, voicing]
for each of the II V and I chords
this function creates a II-V-I voicing array in minor
(string)
string:
array of
[name, root, voicing]
for each of the II V and I chords
this function creates a II-V-I voicing array in minor
(string)
string:
array of
[chordName, root, voicing]
for each of the II V and I chords
this function creates a II-V-I walking bassline in major
object:
array used with Tone.js to play walking bass pattern
this function creates a II-V-I walking bassline in minor
object:
array used with Tone.js to play walking bass pattern
this function makes an array of objects of a chord progression
object:
array used with Tone.js to play chord progression.
this function makes a Frequency array from a scaleFormula and root
number:
array of frequencies
this function makes a noteName array from a scaleFormula and root
object:
array of noteNames
var harm_minor = '1 2 b3 4 5 b6 7 8';
var my_root = "G4";
var g_minor = scaleDegree.makeNoteArray(harm_minor, my_root);
// g_minor = ["G4","A4","Bb4","C5","D5","Eb5","F#5","G5"]
this function makes a noteName chord array from a scaleDegreeChordArray and root
object:
array of noteName
var my_triad = '1 b3 5';
var my_root = "C#4";
var my_chord = scaleDegree.makeChordArray(my_triad, my_root);
// my_chord = ["C#4","E4","G#4"]
this function makes a frequency chord array from a scaleDegreeChordArray and root
object:
array of frequencies
this function makes an array of objects creating a melody
(string)
(string)
(string)
(string)
(string)
object:
array used with Tone.js as melody
var my_scale_degrees = "1 5 6 5";
var my_root = "C4";
var my_durations = ["4n","8n","4n","8n"];
var my_melody = scaleDegree.makeMelody(my_scale_degrees, my_root, my_durations);
// my_melody = [{{note: {value: "C4"}}, {duration: {value: "4n}}, {velocity: {value: 0.7}}},
// {{note: {value: "G4"}}, {duration: {value: "8n}}, {velocity: {value: 0.7}}},
// {{note: {value: "A4"}}, {duration: {value: "4n}}, {velocity: {value: 0.7}}},
// {{note: {value: "G4"}}, {duration: {value: "8n}}, {velocity: {value: 0.7}}}]
this function transposes an arrayOfNotes by a specified number of half steps
string:
string array of transposed notes
NOTE: doesn't deal with correct name but only the correct sounding pitch
this function returns the letter name of any scale degree for a given key
string:
noteName of scale degree