0.69.7 • Published 8 years ago

tonal-notation v0.69.7

Weekly downloads
18
License
MIT
Repository
-
Last release
8 years ago

tonal-notation npm version

tonal

tonal-notation is a collection of functions to create and manipulate strings with music information.

This is part of tonal music theory library.

You can install via npm: npm i --save tonal-notation

API Reference

toStep(letter) ⇒ Integer

Given a letter, return step

Returns: Integer - the step number (from 0 to 6)

ParamTypeDescription
letterStringthe letter

isStep(step) ⇒ Boolean

Test if a number is a valid step number (a number from 0 to 6)

Returns: Boolean - true if it's a valid step number, false otherwise

ParamTypeDescription
stepIntegerthe step number

toLetter(step) ⇒ String

Given a step, return a letter

Returns: String - the note letter or null if not valid step number

ParamTypeDescription
stepIntegerthe step number

areFlats(str) ⇒ Boolean

Test if a string are all flats (b) chars

Returns: Boolean - true if all charaters are b, false otherwise

ParamTypeDescription
strStringthe string to test

areSharps(str) ⇒ Boolean

Test if a string are all sharps (#) chars

Returns: Boolean - true if all charaters are #, false otherwise

ParamTypeDescription
strStringthe string to test

toAlt(accidentals) ⇒ Integer

Given an accidentals string return its alteration, the number of semitones (positive for sharps, negative for flats, 0 for none)

Returns: Integer - the alteration number of null if not a valid accidental strings

ParamTypeDescription
accidentalsStringthe string to parse

Example

toAlt('###') // => 3
toAlt('bbb') // => -3

toAcc(alteration) ⇒ String

Given an alteration number, returns the accidentals string

Returns: String - the accidental string

ParamTypeDescription
alterationIntegerthe number of semitones (positive and negative values are accepted for sharps and flats)

Example

toAcc(3) // => '###'
toAcc(-3) // => 'bbb'
0.69.7

8 years ago

0.69.6

8 years ago

0.69.3

8 years ago

0.69.2

8 years ago

0.69.0

8 years ago

0.64.0

9 years ago

0.61.0

9 years ago

0.60.0

9 years ago

0.50.0

9 years ago