Predefined constants for common musical objects and properties.
- Source:
Example
// Inject all names into the global namespace.
// WARNING: This is not safe to do in large/serious projects, however,
// it is very convenient when experimenting with this library.
require('midikit/names').into(global);
Members
(static) CHORDS
Common Chord types defined in terms of scale degree offsets (the third argument to the Chord constructor)
TRIAD
QUARTAL
QUINTAL
SEVENTH
Note: whether a chord such as a triad is major, minor, diminished, or augmented depends on the scale and the root of the chord. This is because chords in midikit are defined in terms of scale degrees, so you don't have to worry about accidentally using notes that aren't part of the scale. If you don't know music theory, don't worry about it! When using scales and chords in midikit, things will tend to sound good by default.
- Source:
- See:
Example
const { PITCH_CLASSES, SCALE_TYPES, CHORD_TYPES } = require('chorus');
const { C } = PITCH_CLASSES;
const { MAJOR } = SCALE_TYPES;
const { TRIAD, SEVENTH } = CHORD_TYPES;
const { Scale } = require('chorus');
const cMajorScale = new Scale(C, MAJOR);
const I_CHORD = new Chord(TRIAD, 0, cMajorScale); // C major triad
const IV_CHORD = new Chord(TRIAD, 3, cMajorScale); // F major triad
const V7_CHORD = new Chord(SEVENTH, 4, cMajorScale); // G major dominant 7th chord
const vi_CHORD = new Chord(TRIAD, 5, cMajorScale); // a minor triad
(static) PITCH_CLASSES
The 12 PitchClasses:
C, Db, D, Eb, E, F, Gb, G, Ab, A, Bb, B
- Source:
(static) PITCHES
The 128 Pitches:
C_1, Db_1, D_1, Eb_1, E_1, F_1, Gb_1, G_1, Ab_1, A_1, Bb_1, B_1, C0, Db0, D0, ..., Ab8, B8, C9, Cb9, D9, Db9, E9, F9, Gb9, G9
C_1
is the minimum Pitch value of 0 ("_1"
means -1 octave number).
G9
the is maximum Pitch value of 127.
- Source:
(static) SCALES
Common Scale types defined in terms of intervals (the second argument to the Scale constructor):
IONIAN
, also known as:MAJOR
DORIAN
PHRYGIAN
LYDIAN
MIXOLYDIAN
AEOLIAN
, also known as:MINOR
NATURAL_MINOR
LOCRIAN
HARMONIC_MINOR
- Source:
- See:
Example
const { PITCH_CLASSES, SCALE_TYPES } = require('midikit/names');
const { C } = PITCH_CLASSES;
const { MAJOR } = SCALE_TYPES;
const { Scale } = require('chorus');
const cMajorScale = new Scale(C, MAJOR);
Methods
(static) into(namespace)
Inject all predefined names into the given Object.
Parameters:
Name | Type | Description |
---|---|---|
namespace |
Object | the object whose properties will be destructively modified to set all name/values defined here |
- Source: