New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonal-note

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-note

Encode pitches using fifths/octaves

  • 0.50.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
increased by27.61%
Maintainers
1
Weekly downloads
 
Created
Source

tonal-note npm version

tonal

tonal-note is a collection of functions to manipulate music note properties.

This is part of tonal music theory library.

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

API Reference

chroma(note)Integer

Return the chroma of a note. The chroma is the numeric equivalent to the pitch class, where 0 is C, 1 is C# or Db, 2 is D... 11 is B

noteName(n)String

Given a note (as string or as array notation) returns a string with the note name in scientific notation or null if not valid note

pc(n)String

Get pitch class of a note. The note can be a string or a pitch array.

enharmonics(note)Array

Get the enharmonics of a note. It returns an array of three elements: the below enharmonic, the note, and the upper enharmonic

enh()

An alias for enharmonics

simpleEnh(note)String

Get a simpler enharmonic note name from a note if exists

chroma(note) ⇒ Integer

Return the chroma of a note. The chroma is the numeric equivalent to the pitch class, where 0 is C, 1 is C# or Db, 2 is D... 11 is B

Kind: global function
Returns: Integer - the chroma

ParamType
noteString | Pitch

noteName(n) ⇒ String

Given a note (as string or as array notation) returns a string with the note name in scientific notation or null if not valid note

Kind: global function

ParamType
nPitch | String

Example

import { noteName } from 'tonal-notes'
['c', 'db3', '2', 'g+', 'gx4'].map(noteName)
// => ['C', 'Db3', null, null, 'G##4']

Example

var tonal = require('tonal')
tonal.noteName('cb2') // => 'Cb2'
tonal.map(tonal.noteName, 'c db3 2 g+ gx4')

pc(n) ⇒ String

Get pitch class of a note. The note can be a string or a pitch array.

Kind: global function
Returns: String - the pitch class

ParamType
nString | Pitch

Example

tonal.pc('Db3') // => 'Db'

enharmonics(note) ⇒ Array

Get the enharmonics of a note. It returns an array of three elements: the below enharmonic, the note, and the upper enharmonic

Kind: global function
Returns: Array - an array of pitches ordered by distance to the given one

ParamTypeDescription
noteStringthe note to get the enharmonics from

Example

enharmonics = require('enharmonics')
enharmonics('C') // => ['B#', 'C', 'Dbb']
enharmonics('A') // => ['G##', 'A', 'Bbb']
enharmonics('C#4') // => ['B##3', 'C#4' 'Db4']
enharmonics('Db') // => ['C#', 'Db', 'Ebbb'])

enh()

An alias for enharmonics

Kind: global function

simpleEnh(note) ⇒ String

Get a simpler enharmonic note name from a note if exists

Kind: global function
Returns: String - the simplfiied note (if not found, return same note)

ParamTypeDescription
noteStringthe note to simplify

Example

var enharmonics = require('enharmonics')
enharmonics.simpleEnh('B#3') // => 'C4'

FAQs

Package last updated on 08 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc