Skip to content

Installation

Currently there is only one version of Meantonal, implemented in C. Adding it to your project is as simple as copying the meantonal.h header file somewhere into your project’s directory, which can be done via the following bash script:

curl https://meantonal.org/meantonal.h > meantonal.h

You must #define MEANTONAL in exactly one file before the first inclusion of meantonal.h:

foo.c
#define MEANTONAL
#include "meantonal.h"
Pitch c4, e4; // declares but does not assign values to two Pitch vectors
Pitch g4 = { 28, 11 }; // directly initialises a Pitch
// assigning values
if (pitch_from_spn("C4", &c4))
fprintf(stderr, "error parsing pitch from SPN");
if (pitch_from_spn("E4", &e4))
fprintf(stderr, "error parsing pitch from SPN");
Interval M3 = interval_between(c4, e4); // creates a major 3rd Interval vector
Interval P5 = interval_between(c4, g5); // creates a perfect 5th interval vector
// etc.

After that, just include meantonal.h in any other files as needed.

bar.c
#include "meantonal.h"
Pitch p;
if (pitch_from_spn("E4", &p))
fprintf(stderr, "error parsing pitch from SPN");
MirrorAxis a;
if (axis_from_spn("C4", "G4"))
fprintf(stderr, "error parsing pitch(es) from SPN when creating MirrorAxis");
pitch_invert(p, a); // p has been inverted about the axis to Eb4
// etc.