Parse notes in scientific notation
import { parse, name, tokenize } from "@tonaljs/notation-scientific";
parse("cb4"); // => { step: 0, oct: 4, alt: -1 }
Given a note name in [scientific notation] it returns an array with the different parts:
tokenize("Abb4 major"); // => ["", "A", "bb", "4", "major"]
Given a note name, it returns an object with the following properties:
- step (number): the letter number (0..6)
- alt (number): the accidental number (..., -1 = 'b', 0 = '', 1 = '#', ...)
- oct (number?): the optional octave
Given the result of parse
it returns the name.
name({ step: 1, oct: 2, alt: 1 }); // => "D#1"