Releases: stevekinney/octavian
Releases · stevekinney/octavian
Chord Support
You can create chords with Octavian. Check out the release on npm.
const cMajorChord = new Octavian.Chord('C4', 'major');
cMajorChord.notes; // returns [ { letter: 'C', modifier: null, octave: 4 },
// { letter: 'E', modifier: null, octave: 4 },
// { letter: 'G', modifier: null, octave: 4 } ]
cMajorChord.signatures; // returns [ 'C4', 'E4', 'G4' ]
cMajorChord.frequencies; // returns [ 261.626, 329.628, 391.995 ]
cMajorChord.pianoKeys; // returns [ 40, 44, 47 ]
You can create the following chords:
major
majorSixth
majorSeventh
majorSeventhFlatFive
majorSeventhSharpFive
minor
minorSixth
minorSeventh
minorMajor
dominantSeventh
diminished
diminishedSeventh
halfDimished
You're also more than welcome to use the following aliases for any of the above:
maj
is an alias formajor
6
is an alias formajorSixth
maj6
is an alias formajorSixth
7
is an alias formajorSeventh
maj7
is an alias formajorSeventh
maj7b5
is an alias formajorSeventhFlatFive
maj7#5
is an alias formajorSeventhSharpFive
min
is an alias forminor
m
is an alias forminor
min6
is an alias forminorSixth
m6
is an alias forminorSixth
min7
is an alias forminorSeventh
m7
is an alias forminorSeventh
m#7
is an alias forminorMajor
min#7
is an alias forminorMajor
m(maj7)
is an alias forminorMajor
dom7
is an alias fordominantSeventh
dim
is an alias fordiminished
dim7
is an alias fordiminishedSeventh
m7b5
is an alias forhalfDiminshed
Adding Notes to a Chord
You can add notes to a chord manually, if that suits you:
const chord = new Octavian.Chord('C4');
chord.signatures; // returns ['C4']
chord.addInterval('majorThird');
chord.signatures; // returns ['C4', 'E4']
chord.addInterval(7);
chord.signatures; // returns ['C4', 'E4', 'G4']
Turning a Note into a Chord
You can turn any note into the basis for a chord:
const note = new Octavian.Note('C4');
note.toChord(); // returns a new chord with only C4 in it.
note.toChord('major'); // returns a new chord with C4, E4, and G4 in it
2.0 is the new 1.0
There are two important digits in this version number.
The 2 in 2.0.5 represents a ground up rewrite. 1.0.0 was a single function that told you what musical octave a given frequency was in. I wanted more, but I liked the name. As you can see from the README.md
, 2.0.0 does a lot more and is very different.
So, what about the 5? Well, it took me that many tries to figure out that my .gitignore
was futzing with my deployment. Whoops.