npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tonal-notation

v0.69.7

Published

Music notation utilities

Downloads

2,316

Readme

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)

| Param | Type | Description | | --- | --- | --- | | letter | String | the 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

| Param | Type | Description | | --- | --- | --- | | step | Integer | the step number |

toLetter(step) ⇒ String

Given a step, return a letter

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

| Param | Type | Description | | --- | --- | --- | | step | Integer | the step number |

areFlats(str) ⇒ Boolean

Test if a string are all flats (b) chars

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

| Param | Type | Description | | --- | --- | --- | | str | String | the string to test |

areSharps(str) ⇒ Boolean

Test if a string are all sharps (#) chars

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

| Param | Type | Description | | --- | --- | --- | | str | String | the 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

| Param | Type | Description | | --- | --- | --- | | accidentals | String | the 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

| Param | Type | Description | | --- | --- | --- | | alteration | Integer | the number of semitones (positive and negative values are accepted for sharps and flats) |

Example

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