note-filter
Filter notes using using a function or collection of notes:
var filter = // filter by pitch class // => ['C3', 'C2', 'C4'])// filter by note // => ['C3']// filter by collection // => [ 'C2', 'C3', 'G3' ]) // partially appliedvar cMajorFilter = // => 'C3' // => null
Install via npm: npm i --save note-filter
This is part of tonal:
var tonal = tonal // => ['C2', 'A2', 'B2']
Usage
Filter using a function
You can create a filter with a function. The function will receive notes in array notation:
var f = // only 'C' notes // => ['C2', 'C3']
Filter using allowed notes
You can pass a list of allowed notes to create a filter:
var cMajor = // => ['C', 'D']
Filter midi notes
The filter.midi
function works with collection of midi numbers. It returns properly named notes:
var cMinor = filter // => [ 'C4', 'D4', 'Eb4', 'F4', 'G4', 'Ab4', 'Bb4', 'C5' ]
License
MIT License