Meantonal is a specification for representing pitch information in Western music, and a suite of tools for operating on this information. It's a small, focused library that aims to empower developers to build musical apps more easily.
Meantonal is:
- Flexible with I/O: easily ingest and translate between Scientific Pitch Notation, Helmholtz notation, ABC and Lilypond. Extract MIDI values at any time.
- Semantically nondestructive: the distinction between enharmonic notes such as C♯ and D♭ is maintained. Things that don't behave the same way musically are not encoded the same way in Meantonal.
- Just vectors: under the hood pitches and intervals are 2d vectors. Operations are simple to understand, surprisingly powerful, and fast to execute.
- Tuning-agnostic: Target any meantone tuning system, not just 12-tone equal temperament. You want 31 tones per octave? Done.
For the C implementation of Meantonal click here.
Adding Meantonal to your project is as simple as running:
npm install meantonalYou're now ready to import and use Meantonal's classes.
import { SPN, Helmholtz, Interval, TonalContext, MirrorAxis } from "meantonal";
let p = SPN.toPitch("C4");
let q = Helmholtz.toPitch("e'");
let m = p.intervalTo(q); // M3
let n = Interval.fromName("M3");
m.isEqual(n); // true
let context = TonalContext.fromStrings("Eb", "major");
q = q.snapDiatonic(context); // q has now snapped to Eb4
let axis = MirrorAxis.fromSPN("D4", "A4");
q = q.invert(axis); // q is now G#4A full reference of the TypeScript implementation of Meantonal can be found here