Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

note-to-frequency

duivvv119MIT1.4.1

🎼 converts a note (scientific pitch notation) to a frequency

audio, note, scientific pitch, frequency, web audio, music, music theory

readme

note-to-frequency

Node NPM Travis David Coverage Status Gitmoji

🎼 Converts a note (scientific pitch notation) to a frequency

Usage


import noteToFrequency from 'note-to-frequency';

const frequency = noteToFrequency('A4');
console.log(frequency); // > 440

Installation

Install via yarn

yarn add note-to-frequency (--dev)

or npm

npm install note-to-frequency (--save-dev)

configuration

You can pass in extra options as a configuration object (➕ required, ➖ optional, ✏️ default)


import noteToFrequency from 'note-to-frequency';

const frequency = noteToFrequency('C2', {base: 446, maxOctave: 4});
console.log(note); // > 66.3

base ( Number ) ✏️ 440
📝 base frequency

maxOctave ( Number ) ✏️ 8
📝 max octave allowed

Examples

see example folder or the runkit example

Builds

If you don't use a package manager, you can access note-to-frequency via unpkg (CDN), download the source, or point your package manager to the url.

note-to-frequency is compiled as a collection of CommonJS modules & ES2015 modules for bundlers that support the jsnext:main or module field in package.json (Rollup, Webpack 2)

The note-to-frequency package includes precompiled production and development UMD builds in the dist folder. They can be used directly without a bundler and are thus compatible with many popular JavaScript module loaders and environments. You can drop a UMD build as a <script> tag on your page. The UMD builds make note-to-frequency available as a window.noteToFrequency global variable.

Misc

This module was created using generator-module-boilerplate.

License

MIT