- What note is a minor 3rd above a B?
- What are the scale tones of a Gb Harmonic Minor?
- What relation is the C# note to an A Major scale? (Major 3rd)
- What accidentals should be displayed for the perfect 4th note of a G Major scale?
The API is part of VexFlow, and can be used independently of the rendering API. Take a look at music.js in the VexFlow GitHub repository for the complete reference. There's also a handy key management library for building scores in keymanager.js.
I'm currently working on updating the VexFlow Tutorial with a quickstart on the music theory API, but meanwhile, here are some teasers (pulled straight out of the tests).
// What does C note consist of? var parts = music.getNoteParts("c"); equals(parts.root, "c"); equals(parts.accidental, null); // What does C# note consist of? var parts = music.getNoteParts("c#"); equals(parts.root, "c"); equals(parts.accidental, "#"); // What is a flat-5th above C? var value = music.getRelativeNoteValue(music.getNoteValue("c"), music.getIntervalValue("b5")); equals(value, music.getNoteValue("gb"); equals(value, music.getNoteValue("f#"); // What is the C quality of a Db? equals(music.getRelativeNoteName("c", music.getNoteValue("db")), "c#"); // What are the tones of a C major scale? var c_major = music.getScaleTones( music.getNoteValue("c"), Vex.Flow.Music.scales.major); // result: ["c", "d", "e", "f", "g", "a", "b"] // What is the interval between a C and a D? equals(music.getCanonicalIntervalName(music.getIntervalBetween( music.getNoteValue("c"), music.getNoteValue("d"))), "M2");
Thanks to the theory support, we now have smarter Accidentals in the standard notation stave that VexTab generates.
Notice how the accidentals are correctly picked according to the rules of standard notation? Yep, so do I.
We also have lots more tests -- over 750 of them! Try running them on your browser and tell me how long it takes.
That's all folks!