https://github.com/fwcd/swift-music-web-playground
Web Playground featuring a MIDI keyboard using swift-music-theory, SwiftWasm and Tokamak
https://github.com/fwcd/swift-music-web-playground
music piano-keyboard swift swiftui swiftwasm tokamak webmidi
Last synced: 9 days ago
JSON representation
Web Playground featuring a MIDI keyboard using swift-music-theory, SwiftWasm and Tokamak
- Host: GitHub
- URL: https://github.com/fwcd/swift-music-web-playground
- Owner: fwcd
- License: mit
- Created: 2022-08-20T16:10:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-28T14:26:16.000Z (almost 3 years ago)
- Last Synced: 2025-02-10T10:44:42.956Z (5 months ago)
- Topics: music, piano-keyboard, swift, swiftui, swiftwasm, tokamak, webmidi
- Language: Swift
- Homepage: https://fwcd.github.io/swift-music-web-playground
- Size: 630 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swift Music Web Playground
[](https://github.com/fwcd/swift-music-web-playground/actions/workflows/deploy.yml)
A small demo of [`swift-music-theory`](https://github.com/fwcd/swift-music-theory) in a [SwiftWasm](https://github.com/swiftwasm) + [Tokamak](https://github.com/TokamakUI/Tokamak) web app. [Try it out on the web here!](https://fwcd.github.io/swift-music-web-playground)

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](#supported-browsers)).
## Getting Started
Make sure to have [Carton](https://github.com/swiftwasm/carton) installed. To start the development server that continuously rebuilds the app, run
```sh
carton dev
```To bundle the app for production, run
```sh
carton bundle
```## Supported Browsers
The base functionality requires a browser that supports HTML5, Canvas and [Web Audio](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API), which all modern browsers should provide.
Playing notes with a MIDI controller (e.g. an external MIDI keyboard) requires support for [Web MIDI](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API), 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 to `true`
- `dom.webmidi.gated` set to `false`