open-audiovisual
Search GitHub

Documentation

MIDI controllers & embedding#

Chapter 14 of 24Source: docs/controllers.md

open-audiovisual models MIDI controllers as data: one JSON file per device, with the faceplate layout, every control's exact MIDI message, LED feedback, how to recognise its port, and the document each number came from. The same file drives an on-screen controller you can play, follows the real device when you plug it in, and can be dropped into any web page. Every device is on the controllers page.

Play one in a page#

html
<script type="module" src="https://openaudiovisual.com/packages/midi/element.js"></script>
<oav-controller profile="akai-lpd8" readout></oav-controller>

That is the whole integration. The element works without Web MIDI (Safari, iPad): it plays and fires events; only hardware and MIDI out report that they are unavailable. It never asks for MIDI permission unless you turn on hardware, midi-out or learn. Safari has none because WebKit has not implemented it (bug 107250, still open).

AttributeWhat it does
profilewhich device: an id, a short name, or a URL to your own profile JSON
layoutauto, face (as it looks) or stack (re-gridded for a phone held upright)
hardwareon, or ask for a button: the real device moves the on-screen one
midi-out (or out)ask (a button, then the first virtual cable), virtual (the first IAC / loopMIDI port at once), a port name (IAC, loopMIDI) or /regex/: what you play is sent there, with a port menu and Release all
channel1–16, when your unit is set to another channel
picker, readout, learn, followdevice picker, last-message line, learn button, show whatever known device you plug in

Listen to it#

js
const el = document.querySelector('oav-controller');
el.addEventListener('control', (e) => {
  const { id, value, signal, message, source } = e.detail;
  // 'k1'  0..1  'midi/lpd8/k1'  { type: 'cc', ch: 1, cc: 70, value: 53 }  'ui' | 'hardware'
});
await el.ready;
el.set('k1', 0.5);           // move a control as a hand would
el.ingest([0xb0, 70, 64]);   // MIDI from anywhere: the faceplate follows

Other events: noteon, noteoff, connect, disconnect, status, profilechange, ready, error. All bubble and cross the shadow root. Every field of every payload is in packages/midi/README.md.

Without the element#

js
import { createController } from 'https://openaudiovisual.com/packages/midi/index.js';

const ctl = createController('akai-lpd8', { signals });   // signals: publish into a show
ctl.mount(document.querySelector('#pads'));                // optional
ctl.on('control', (e) => console.log(e.signal, e.value));

Inside a show, do not read midi/lpd8/k1 in update(): route it to a param with controllerRoutes(profile, { k1: 'hue' }) (rule 1 in AGENTS.md). Example 09 does this for six devices at once.

In an iframe#

For places that only take an iframe:

html
<iframe src="https://openaudiovisual.com/embed/controller/?profile=akai-lpd8&readout&frame=pads"
        width="720" height="220" style="border:0" allow="midi" title="AKAI LPD8"></iframe>

The frame posts { source: 'openav', type, frame, detail } to its parent for every event, and accepts { target: 'openav', type: 'set' | 'ingest' | 'press' | 'release' | 'reset' | 'profile' | 'layout' | 'get', … }. Add origin=https://your.site to talk to your page only.

Play your DAW with it#

  1. macOS: Audio MIDI Setup → Window → Show MIDI Studio → IAC Driver → “Device is online”. Windows 11: the built-in Windows MIDI Services (released 2026-02-17, rolled out in stages to 24H2 and 25H2) share MIDI ports between apps and include a loopback, and Microsoft's announcement says web pages using Web MIDI can use it (Windows blog). We have not tested it with open-audiovisual. Older Windows: install loopMIDI and add a port; that still works.
  2. <oav-controller profile="akai-lpd8" midi-out="ask">: a button asks for MIDI on a click, then picks the first virtual cable from step 1, never a hardware port. midi-out="virtual" opens it at once, midi-out="IAC" names it (on Windows, give the name of the port you made or the one Windows shows). In the iframe: ?out=ask, ?out=virtual, ?out=iac.
  3. In Ableton Live, turn on Track and Remote for that input; in TouchDesigner, a MIDI In CHOP on it; in Resolume, Preferences → MIDI.

Hands on the screen are sent; your real hardware is not forwarded (the DAW already hears it). The engine never listens to IAC inputs, and the element mutes an input named like its output, so nothing loops.

What leaves carries the device's own channels and numbers, so a mapping you make with the page fits the real unit later. With an output open the toolbar has a port menu and Release all: one note-off for each note it sent, on the channel it went out on, and nothing else (a sweep of every note on 16 channels would grow TouchDesigner's MIDI In CHOP 2,000-odd channels). Every message that leaves fires sent { bytes, message, port, td }; td is the channel name the MIDI In CHOP shows (ch1ctrl70, ch10n36, with 1 Based Index off; see tdChannel() in the reference). el.setOutputChannel(2) sends everything on channel 2; el.releaseSent() is the button.

Every controller page has this built in: Send MIDI under its faceplate (off until pressed), the output, the channel, Release all, and a TouchDesigner column in its MIDI table. Without a controller at all, the Web MIDI controller is faders, knobs, an XY pad and pads on numbers you choose.

Telemetry#

So the project can see where its controllers and shows end up, the packages send one anonymous hit per page load to Google Analytics 4 (the openaudiovisual.com property, G-1YG2JHK2WT):

eventwhenparams
oav_embed_loadan <oav-controller>, createController() or the iframe startsoav_kind (element · headless · iframe), oav_profile, oav_host, oav_version
oav_hardware_connecta real controller is plugged in and matchedoav_kind, oav_profile, oav_host, oav_version
oav_show_startcreateShow() startsoav_kind (show), oav_host, oav_version

oav_host is the origin of the page it runs on (for the iframe, the page that holds it), never the path, query or title. Nothing anyone plays is sent, no cookies are set, and the client id is random for every page load, so visitors can't be followed. No gtag.js is loaded: a page with its own Google Analytics keeps its dataLayer untouched. Nothing is sent from localhost, LAN addresses, file:// or openaudiovisual.com itself, or when the browser sends Do Not Track / Global Privacy Control.

Turn it off: <oav-controller telemetry="off"> · createController(p, { telemetry: false }) · createShow({ telemetry: false }) · the iframe's ?telemetry=0 · or globalThis.OPENAV_TELEMETRY = false before anything loads. Source: packages/midi/telemetry.js.

The one line for p5.js (oav-p5) sends nothing unless a sketch sets telemetry: 'on'.

The signature is not a hit. createShow() also puts <meta name="generator" content="open-audiovisual 0.9.0"> in the page's head, the tag WordPress and Hugo leave. It makes no request: a person who views the source, a search of the public web or a web census can read which pages run on open-audiovisual, and that is all. createShow({ signature: false }) leaves it out. Source: packages/core/src/signature.js. Works that want to be listed by name add themselves to Made with.

The site's own pages#

openaudiovisual.com runs Google Analytics 4 on its own pages (the same property). Besides the page views Google Analytics counts by itself, assets/track.js counts nine things people do there, each as its own event:

eventwhenparams
oav_copya Copy button, or ⌘C / Ctrl+C inside a code blockkind (loader · code · import_map · other), page_type
oav_outbounda link to another sitekind (github · vendor · work · course · openprocessing · other), host, page_type
oav_controller_playthe first move on a page's on-screen controller, once per page viewcontroller, page_type
oav_export_downloada QLC+, Mixxx or JSON file from a controller, fixture or device pageformat (qlc · mixxx · json), controller (the controller's, fixture's or device's id), page_type
oav_example_startthe first click or key inside an example, once per page viewexample
oav_next_stepa link in a page's next-step blockfrom (the page type), to (p5 · example · docs · reference · …)
oav_searchthe first letter typed in a search box, once per page viewpage_type
oav_lang_switchEN or 中文page_type, to (en · zh)
oav_send_to_desktopthe button of the bar a phone shows, "Send this page to your computer"method (share · copy), page_type

page_type says what kind of page it is: home, controller, controllers_index, verify, example, examples_index, docs, docs_chapter (/docs/<chapter>/), reference, reference_name (/docs/reference/<name>/), cheatsheet, p5, made_with, changelog, webtoe, check, not_found, devices_index (/devices/), fixture (/fixtures/<id>/) or device (/devices/<id>/). Each param is a short word or an id, never what was copied or typed into a search box, and never a link's path or query: host is the other site's name only. As with every page view, Google Analytics itself also records the page's address and sets its own cookie. The script runs only where the site's analytics runs, on openaudiovisual.com: not on localhost and not in a copy of the repository. Source: assets/track.js.

None of this is in the framework. p5/oav-p5.js, packages/ and embed/ do not load the script and send nothing new, so a page someone else builds with open-audiovisual sends only what the first table lists. tests/track.test.js checks both.

SysEx: modes, templates, LED colours#

Some things only SysEx can do: put a Launchpad in Programmer mode, pick a Launch Control XL template, light a pad in any RGB colour. Profiles that have these list them in sysex, each message with its source, and the device's page shows them.

The browser shows a permission prompt for SysEx, so nothing in this project asks by itself: <oav-controller sysex> adds a button, and controller.enableSysex() is the call behind it (run it from a click). Once it is on, the device is set up every time it connects, and setLedColor(id, { r, g, b }) and sendSysex(id) work. Package README.

In other software#

Every device page has the same data as a QLC+ input profile (.qxi) and a Mixxx mapping (.midi.xml and a small .js), and node tools/export-controller.mjs <id> writes them from any profile. The Mixxx mapping is a starting point: remap it with Mixxx's Learning Wizard. The library also lists controllers imported from QLC+'s input profiles, with generated layouts and every control marked unverified.

Add a controller#

  1. Copy the closest file in packages/midi/profiles/, or a generic layout.
  2. Write each control's type and message from the manual's MIDI implementation chart.
  3. Cite every source; mark anything unconfirmed "verified": false with a note. "verified": true is for a number checked on a real unit, and needs an entry in verifications that says who, when, on which firmware, OS and browser (validateProfile refuses it otherwise).
  4. validateProfile(profile) lists every problem; npm test checks every shipped profile.
  5. Try it with <oav-controller profile="./my-device.json">, then register it in profiles/index.js and open a pull request.

No manual: choose a generic layout, press Learn, move your controls in order, and keep controller.exportMapping() as the start of a profile.

The format has room for what a device does beyond notes and CCs: sysex (mode switches, templates, LED colours, each message citing its source), palette (the LED colour table) and verifications (who checked what on real hardware). The field list is in the package README, and profile.schema.json is the same format as JSON Schema.

↑ Back to top · All chapters