Stream based midi loop maker. Buffers all input then creates loops on demand.
Stream based midi loop maker. Buffers all input then creates loops on demand.
$ npm install midi-looper
var MidiLooper = require('midi-looper')
var looper = MidiLooper(clock.getPosition)
Create a looper instance. You must pass in a function that when called returns the current playback position (in beats).
Stores a note in the buffer at the position returned by getPosition()
.
Whenever the playback changes (due to a transform()
or store()
), emits the new output playback e.g. ({length: 8, notes: [[144, 60, 127, 0, 0.5], [144, 60, 127, 1, 0.5]]}
- array of [channel, note, velocity, position % length, noteLength])
Sets the current playback to loop the buffered notes from getPosition() - length
to current time. Preroll will include the desired overlap.
Apply a transform functions to the playback. The combined transforms are returned by getOutput()
. Returns a release()
function that can be called to remove the transform.
Returns the total number of transforms currently applied to output.
Bounce the final output with transforms applied back to the input and clear the active transforms.
setLength()
, store()
and bounce()
all generate undo history which can be navigated using the undo()
and redo()
functions.
Returns the current playback loop without transforms applied.
Returns the current playback loop with transforms applied.
Current input playback loop length.
Set the loop length, repeating or truncating the playback as neccessary centred around getPosition()
.
Pass in an array of note keys ("144/25"
) to suppress, or if noteKeysToSuppress
is null, suppress all notes.
Add the specified notes in as an array ([channel, note, velocity, position, duration])
Specify the midi notes ([chan, note, vel]) you want to repeat at the rate
specified.
Shift all note playback positions by offset.
Loops playback notes from start
and if length exceeds the total loopLength, the notes are repeated to fill.
Like loop
except preserves the original playback length
Quantize the specified notes (or null for all notes) to quantize at the grid
specified.