cycle-midi
Cycle.js drivers to send and receive notes using Web MIDI.
Drivers
connectionDriver
connectionDriver
accepts a stream. Whenever that stream dispatches, it tries to connect to the instrument over Web MIDI. It returns a stream that dispatches true
when the connection attempt succeeds and false
when it fails.
instrumentDriver
instrumentDriver
accepts a stream of notes to send to the instrument. It may eventually return a stream of notes played on the instrument, but it doesn't do that yet.
Example
{ const connectionRequest$ = message$; const playRandomNote$ = message$; return instrumentConnection: connectionRequest$ instrument: playRandomNote$ messages: instrumentAvailability$ }
To see an real extension written with these drivers, check out the midicast source code.
Installation
yarn add cycle-midi
Usage
Because the two drivers share a single connection to the instrument, you must instantiate them together with makeInstrumentAndConnectionDriver()
:
; const instrumentDriver connectionDriver = ; ;