voltergeist

web: the browser pages

This page is web/README.md from the repository.

Two pages, no build step, nothing to install beyond Chrome:

Both pages connect to their own origin's /ws by default, or to a relay room with ?relay=wss://ws.positron.studio&room=<room>. So they work from any static host, and from node web/serve.mjs.

parameterpagemeaning
relaybotha relay base URL (wss://ws.positron.studio), or a full ws://host:port/ws
roomboththe relay room; both pages must use the same one. Anybody who knows the name can join it
delayreceiveplayout delay in ms; default 20, or 80 over a relay
capreceivemax values a second per channel, default 500
modereceivehold (default) or interpolate across a lost sample
source=midisendstart with the MIDI input chosen
startsendstart sending on load

Before any test:

Below, ROOM is any name you choose, for example vg-studio-7f3k.

a. Laptop test signal into Live on the M1, over the Cloudflare relay

  1. On the laptop: node web/serve.mjs, then open http://127.0.0.1:8091/web/send.html?relay=wss://ws.positron.studio&room=ROOM&start. It sends four channels (ramp1, sine2, square3, ramp4), 1000 Hz.
  2. On the M1: node web/serve.mjs, then open http://127.0.0.1:8091/web/receive.html?relay=wss://ws.positron.studio&room=ROOM, allow MIDI, and choose IAC Driver Bus 1 as the MIDI output. The four bars move; ramp1 goes out on CC 1 and 33, sine2 on CC 2 and 34, and so on, MIDI channel 1.
  3. In Live: Settings, Link Tempo MIDI, turn Remote on for the input IAC Driver (Bus 1).
  4. Map a knob. Press Cmd+M, click the device knob, press learn next to sine2 on the receive page (only that channel is sent while learn is on), press Cmd+M again, then press learn again to send every channel. If the knob moves in coarse steps, set that row to CC 7-bit on the page and map it again.

b. Live to the world: Live's MIDI out into the send page on the M1

  1. In Live, set a MIDI track's MIDI To to IAC Driver (Bus 1). Its clip's notes, CC envelopes and pitch bend go to the IAC bus.
  2. On the M1: open http://127.0.0.1:8091/web/send.html?relay=wss://ws.positron.studio&room=ROOM&source=midi, choose the MIDI input IAC Driver Bus 1, press Start. Each CC becomes a channel cc<n> as it is first moved (14-bit when Live sends the fine CC n + 32 too), pitch bend becomes bend, notes become events. MIDI messages in counts what arrives.
  3. On the laptop: open http://127.0.0.1:8091/web/receive.html?relay=wss://ws.positron.studio&room=ROOM. The channels and the notes appear; a MIDI output there plays them on the laptop. A channel named cc<n> goes back out as CC n.
  4. Or into the Pi instead of the laptop. The relay is WebSocket and tools/receive.mjs is UDP, so use the bridge. On the Pi run node tools/receive.mjs --port 9100 and node tools/bridge.mjs --host 0.0.0.0 --to 127.0.0.1:9100. On the M1 open http://127.0.0.1:8091/web/send.html?relay=ws://<pi address>:8090/ws&source=midi.

c. Into VCV Rack on the M1

  1. Run the receive page on the M1 as in a, step 2, with IAC Driver Bus 1 as the output (the sender can be the laptop's test signal, or Live as in b).
  2. In VCV Rack, add the Core module MIDI-CC to CV: driver Core MIDI, device IAC Driver Bus 1. Click a slot, then press learn next to a channel on the receive page; the slot takes that CC. Each output is 0 to 10 V. If the module's right-click menu offers 14-bit CC, switch it on for the fine steps.
  3. Add MIDI to CV on the same device for notes (V/OCT, GATE, VEL) and pitch bend (PW).

d. Local only, one machine

  1. node web/serve.mjs, then open http://127.0.0.1:8091/web/send.html?start and http://127.0.0.1:8091/web/receive.html. With no relay both pages meet in the room local at /ws.
  2. Or the UDP path: node tools/receive.mjs and node tools/bridge.mjs, then open http://127.0.0.1:8090/. The bridge carries one browser to one UDP receiver, so receive.html opened from the bridge receives nothing.

Checking the pages

node web/check.mjs drives both pages in headless Chrome (muted, a temp profile it deletes) and checks the bytes they produce, with no MIDI port: both pages through web/serve.mjs, the send page through tools/bridge.mjs to a UDP socket, and both pages through the Cloudflare relay in a random room for a few seconds. --only local, --only bridge or --only relay runs one of them, and --delay <ms> sets the relay run's delay.

../src/midi-encode.mjs holds the MIDI encoders and the input parser. src/midi.mjs imports Node modules, so a browser cannot load it. The pure encoders belong in a browser-safe module that both import.