Skip to content

sole/MIDIUtils

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

MIDIUtils

Methods for dealing with MIDI data (note numbers, note names, frequencies, etc).

Install with NPM

Getting it

Node/Browserify

Install using npm:

npm install midiutils

Then require it before using in your code:

var MIDIUtils = require('midiutils');

MIDIUtils.noteNameToNoteNumber('A-4');

Just the browser, thanks!

You can also download/clone the source. Then just include the source using a script tag before using the library:

<script src="path/to/MIDIUtils.js"></script>

API

noteNameToNoteNumber( name )

Returns the MIDI note number corresponding to the note name.

MIDIUtils.noteNameToNoteNumber( 'A-0' );    // returns 21
MIDIUtils.noteNameToNoteNumber( 'C-4' );    // returns 60

noteNumberToFrequency( number )

Returns the frequency represented by noteNumber.

MIDIUtils.noteNumberToFrequency( 69 ); // returns 440 Hz -- i.e. A-4

noteNumberToName( number )

Returns the MIDI note name corresponding to the note number.

MIDIUtils.noteNumberToName( 21 ); // returns 'A-0'

frequencyToNoteNumber( frequency )

Returns the note number that corresponds to this frequency.

MIDIUtils.frequencyToNoteNumber( 440.000 ); // returns 69

Getting involved

If you want to get involved with the development of this library or want to contribute, make sure the code you add or change follows the same style as the existing code (whitespace, indenting, etc) and looks consistent with the rest.

Also new features must also be accompanied by both documentation and examples, and new tests demonstrating the usage of the feature, and existing tests must not break.

About

A series of methods to work with MIDI

Resources

License

Stars

Watchers

Forks

Packages

No packages published