Navigate to your project directory and install nmusic:
npm install nmusic
In your project file, import nmusic.
var nmusic =// if you'd like, create global variables for the functions you will be usingvar plusInterval = nmusicplusInterval'D4'// or, call all functions directly from nmusicnmusic 'm7'
To work in a functional style, use the many functional methods. These methods all return strings and numbers which represent pitches and intervals. (The example assumes you have assigned all methods to global variables).
To work in an object-oriented style, create Pitch objects. The Pitch methods will return other Pitch objects, but behind the scenes they are just using the same functional methods introduced above.
var p1 = 'Bb3'var p2 = p1p2 'F4'p2 instanceof truep1 'P5'
nmusic is made of a set of sensical music classes like Note, Pitch, Duration, Measure. Most of the functionality of the library will be loaded into the factory method
nmusic which will parse a variety of arguments and return objects of the appropriate class.
Bb3instanceof trueEb4P4Bb3 C4 D4 Eb4 F4 G4 A4
To run eslint and tape tests:
To generate api documentation:
npm run docs
Background & Credits
My first programming project was a simple object oriented music library which I made from scratch to solve counterpoint problems. As I've learned more, I've come back to that library and refactored it several times, and now I aim to completely rebuild it.
tonal is an elegant library written in a functional style.
teoria is an object oriented library.
This library aims to be an intuitive mix between a functional and object-oriented style.