JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q42434F
  • License Apache-2.0

Utilities to express, parse and output musical notes in Scientific and Helmholtz formats.

Package Exports

  • @lyre/note

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lyre/note) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Lyre Note 2.1

Utilities to manipulate, parse and output musical notes. Lyre Note is able to perform common manipulations such as transposition of notes and conversion between sharps and flats. Functions Parse and Stringify natively support Scientific and Helmholtz notations and conversion between the two.

Installation

npm install @lyre/note

Usage

Basic usage

var Note = require('@lyre/note');

//create a note
var myNote = new Note('Db', 4);

myNote.getSharp(); //return C#
myNote.transpose(2); //transposes a whole step up to Eb
myNote.transpose(-2); //transposes a whole step down to B

Parsing

var Parse = require("@lyre/note").Parse;

var myScientificNote = Parse("C4"); //create middle C in scientific notation, scientific is default
var myHelmholtzNote = Parse("c'", Parse.Helmholtz); //create middle C in helmholtz notation

Stringifying note objects

var Stringify = require("@lyre/note").Stringify;
var Parse = require("@lyre/note").Parse;

var myNote = Parse("C4"); //create middle C in scientific notation
console.log( Stringify( myNote, Stringify.Helmholtz ) ); //then output in helmholtz notation

//note also has a convenience method to stringify
myNote.toString(Stringify.Helmholtz);

API

Visit the API documentation.

Test

From the root directory

npm run test