The new version of MIDIVal just landed bringing an easier way to use MIDI Clock in your app.
Introducing MIDIVal: the easiest way to interact with MIDI in your browser
Use high level API to quickly connect with MIDI in your next project!
Listening to MIDI Clock Messages
Now you can listen to all MIDI Clock messages like Clock Start, Stop and Continue as well as to individual pulse messages (sent 24 times every quarter note). This allows you to synchronize your Web-based music with an external clock from your synthesizer (or your DAW), create real-time applications based on the clock, or even send it over the web (or whatever else you can imagine).
Moreover, if you want to compute and use tempo (beats per minute) in which your MIDI device is sending those messages, you can use MIDIVal to automatically compute that for you. Then you can access it anytime:
If you forget to set
computeClockTempo option, getting tempo will throw
MIDIValConfigurationError on access attempt.
Sending MIDI Clock Messages
You can also send MIDI Messages to your MIDI Output device now. The following new methods are available:
Besides adding MIDI Clock messages extended support, new versions of MIDIVal have been reworked from the ground up to incorporate my other project, Omnibus — a simple implementation of platform-agnostic Event Bus. The initial implementation of the event bus in MIDIVal was a direct inspiration for this library and I decided to make it reusable in different projects.
Introducing Omnibus: new Event Bus library written in TypeScript
event bus library for all
In addition, MIDI Callbacks are not much nicely typed and Note On/Off, CC and Program Change messages get the parameters nicely mapped to logical names:
This can allow for tidier code without having to bother about MIDI message internals even more.