![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
tonal-note
Advanced tools
tonal-note
is a collection of functions to extract properties from musical notes.
This is part of tonal music theory library.
You can install via npm: npm i --save tonal-note
Read the generated API documentation.
tonal-note
is a collection of functions to get properties from musical notes.
Example
var note = require('tonal-note')
note.name('bb2') // => 'Bb2'
note.chroma('bb2') // => 10
note.enharmonics('C#6') // => [ 'B##5', 'C#6', 'Db6' ]
note.simplify('B#3') // => 'C4'
Integer
String
String
Array
String
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: static method of note
Returns: Integer
- the chroma
Param | Type |
---|---|
note | String | Pitch |
Example
['C', 'D', 'E', 'F'].map(_.chroma) // => [0, 2, 4, 5]
_.map(_.chroma, 'cb db eb fb') // => [11, 1, 3, 4]
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: static method of note
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') // => [ 'C', 'Db3', null, null, 'G##4' ]
String
Get pitch class of a note. The note can be a string or a pitch array.
Kind: static method of note
Returns: String
- the pitch class
Param | Type |
---|---|
n | String | Pitch |
Example
tonal.pc('Db3') // => 'Db'
tonal.map(tonal.pc, 'db3 bb6 fx2') // => [ 'Db', 'Bb', 'F##']
Array
Get the enharmonics of a note. It returns an array of three elements: the below enharmonic, the note, and the upper enharmonic
Kind: static method of note
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
var note = require('tonal-note')
note.enharmonics('C') // => ['B#', 'C', 'Dbb']
note.enharmonics('A') // => ['G##', 'A', 'Bbb']
note.enharmonics('C#4') // => ['B##3', 'C#4' 'Db4']
note.enharmonics('Db') // => ['C#', 'Db', 'Ebbb'])
String
Get a simpler enharmonic note name from a note if exists
Kind: static method of note
Returns: String
- the simplfiied note (if not found, return same note)
Param | Type | Description |
---|---|---|
note | String | the note to simplify |
Example
var note = require('tonal-note')
note.simplify('B#3') // => 'C4'
FAQs
Parse and manipulate music notes in scientific notation
The npm package tonal-note receives a total of 140 weekly downloads. As such, tonal-note popularity was classified as not 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.