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

twelvetet-spn

v0.3.2

Published

Scientific pitch notation parser/formatter for Node.js and the browser

Downloads

28

Readme

twelvetet-spn

Scientific pitch notation parser/formatter for Node.js and the browser.

Installation

Install the latest stable version of twelvetet-spn using npm:

npm install twelvetet-spn

You can also access the files on unpkg.com.

You can use twelvetet-spn with module bundlers.

The twelvetet-spn npm package includes precompiled production and development UMD builds in the dist/ folder. They can be used without a bundler.

The UMD builds make twelvetet-spn available as window.TwelveTetSPN global variable.

twelvetet-spn works in any modern browser and Node.js.

Usage

import { format, parse } from 'twelvetet-spn'

parse('A4') // [9, 4]

// NOTE: `format()` always returns an array of five elements
// ordered as follows: `[<double_sharp>, <sharp>, <natural>, <flat>, <double_flat>]`.
// An element is `null` when there is no corresponding enharmonic equivalent.
format([9, 4]) // ['Gx4', null, 'A4', null, 'Bbb4']

API

twelvetet-spn.format(value) ⇒ Array

Formats a musical pitch to scientific pitch notation.

Kind: static method of twelvetet-spn
Returns: Array - An array of scientific pitch notation enharmonic equivalents of the musical pitch. The array always has 5 elements. The order is always [<double sharp>, <sharp>, <natural>, <flat>, <double flat>]. An element of the array is null if there is no corresponding enharmonic equivalent
Throws:

  • TypeError Will throw an error if the value argument is not an array

| Param | Type | Description | | --- | --- | --- | | value | Array.<Number> | An array representing the musical pitch's class and octave. | | value.0 | Number | The pitch class of the musical pitch. | | value.1 | Number | The octave of the musical pitch. |

twelvetet-spn.parse(value) ⇒ Array.<Number>

Parses scientific pitch notation of a musical pitch.

Kind: static method of twelvetet-spn
Returns: Array.<Number> - An array representing the musical pitch's class and octave.
Throws:

  • TypeError Will throw an error if the value argument is not a string

| Param | Type | Description | | --- | --- | --- | | value | String | Scientific pitch notation of a musical pitch. |

License

This project is MIT-licensed