Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
tonal-freq
Advanced tools
tonal-freq
is a collection of functions to perform calculations related to frequencies.
This is part of tonal music theory library.
You can install via npm: npm i --save tonal-freq
function
Return a function that converts midi or notes names to frequency using equal temperament.
Float
Get the frequency of a pitch using equal temperament scale and A4 equal to 440Hz
function
Create a function that returns a midi number from a frequency using an
equal temperament and ref
frequency as 'A4' frequency.
Integer
Get note from frequency using a equal temeperament scale and 440Hz as freq reference
String
Get note name from frequency using an equal temperament scale with 440Hz as reference
Float
Get difference in cents between two frequencies. The frequencies can be expressed with hertzs or midi numbers or note names
function
Return a function that converts midi or notes names to frequency using equal temperament.
Kind: global function
Returns: function
- the frequency calculator. It accepts midi numbers,
note names, pitches and returns a float.
Param | Type | Description |
---|---|---|
ref | Float | the tuning reference |
Example
import { toEqualTemp } from 'tonal-freq'
const toFreq = toEqualTemp(444)
toFreq('A3') // => 222
Float
Get the frequency of a pitch using equal temperament scale and A4 equal to 440Hz
Kind: global function
Returns: Float
- the frequency in herzs
Param | Type | Description |
---|---|---|
note | Number | String | the note name or midi number |
Example
import { toFreq } from 'tonal-freq'
toFreq('A4') // => 440
// using tonal
tonal.toFreq('C4') // => 261.6255653005986
function
Create a function that returns a midi number from a frequency using an
equal temperament and ref
frequency as 'A4' frequency.
Kind: global function
Returns: function
- a function that converts from frequency to midi
Param | Type | Description |
---|---|---|
ref | Float | the frequency of A4 |
Integer
Get note from frequency using a equal temeperament scale and 440Hz as freq reference
Kind: global function
Returns: Integer
- midi number
Param | Type |
---|---|
freq | Float |
String
Get note name from frequency using an equal temperament scale with 440Hz as reference
Kind: global function
Returns: String
- note name
Param | Type |
---|---|
freq | Float |
Float
Get difference in cents between two frequencies. The frequencies can be expressed with hertzs or midi numbers or note names
Kind: global function
Returns: Float
- The difference in cents
Param | Type |
---|---|
base | Float | Integer | String |
freq | Float | Integer | String |
Example
import { cents } from 'tonal-freq'
cents('C4', 261) // => -4.1444603457298985
FAQs
Conversion between frequencies and note names
The npm package tonal-freq receives a total of 13 weekly downloads. As such, tonal-freq popularity was classified as not popular.
We found that tonal-freq 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.