Web Playground featuring a MIDI keyboard using swift-music-theory, SwiftWasm and Tokamak
Swift Music Web Playground
A small demo of swift-music-theory
in a SwiftWasm + Tokamak web app. Try it out on the web here!
Notes can either be played by clicking with the mouse or via a connected MIDI keyboard (the latter requires a browser that implements the Web MIDI API, see below).
Getting Started
Make sure to have Carton installed. To start the development server that continuously rebuilds the app, run
carton dev
To bundle the app for production, run
carton bundle
Supported Browsers
The base functionality requires a browser that supports HTML5, Canvas and Web Audio, which all modern browsers should provide.
Playing notes with a MIDI controller (e.g. an external MIDI keyboard) requires support for Web MIDI, which is not as widely supported yet. Browsers compatible at the time of writing (August 2022) include:
- Chromium-based browsers (e.g. Chrome)
- Firefox Nightly (version 105 or newer) with the following flags:
dom.webmidi.enabled
set totrue
dom.webmidi.gated
set tofalse