![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
tonal-note
Advanced tools
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
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
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
String
Get pitch class of a note. The note can be a string or a pitch array.
Array
Get the enharmonics of a note. It returns an array of three elements: the below enharmonic, the note, and the upper enharmonic
An alias for enharmonics
String
Get a simpler enharmonic note name from a note if exists
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
Param | Type |
---|---|
note | String | Pitch |
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
Param | Type |
---|---|
n | Pitch | 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')
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
Param | Type |
---|---|
n | String | Pitch |
Example
tonal.pc('Db3') // => 'Db'
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
Param | Type | Description |
---|---|---|
note | String | the 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'])
An alias for enharmonics
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)
Param | Type | Description |
---|---|---|
note | String | the note to simplify |
Example
var enharmonics = require('enharmonics')
enharmonics.simpleEnh('B#3') // => 'C4'
FAQs
Parse and manipulate music notes in scientific notation
The npm package tonal-note receives a total of 1,192 weekly downloads. As such, tonal-note popularity was classified as popular.
We found that tonal-note demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.