The studio desk at night; the left monitor shows OTD's own Deck, an arrangement of drum and chord lanes.
The room from the homepage, with the left monitor, OTD's Deck, lit.

03 · OTD · music streaming

A music player that shows you the notes.

1/8

OTD streaming

Watch the notes glow as they pass.

RACK: DECK · PIANO ROLLWhat If?Silent · no audio
Notes, chords and kick hits from OTD’s own analysis files for two tracks by Eli the Kidd, drawn by the deck’s rules (no voice lane, as in OTD). The playhead moves at the track’s tempo, silently, and only when you press play or drag. Keys on the bar: Space play/pause, ← → a beat, with Shift a bar.

silent on purpose. These are Eli the Kidd's real notes, chords and drum hits, drawn the way the app draws them

Beats downloading files to your phone.

The old way

  1. Download the file, then dig it back out of Files
  2. It sits on its own, not queued with anything else

OTD

  1. Tap the link and it plays, no download
  2. Already in the queue, next to everything else

No file. No folder.Same song, one fewer thing to manage.

one link that just plays. Nothing to save, nothing to dig back out of Files later

New songs go straight to the top.

RACK: CATALOG · LATEST
  1. NEWRunawayEli the Kidd
  2. What If? (Pt. 2)Eli the Kidd
  3. What If?Eli the Kidd

Illustrative reorder of the site's own two real tracks. The real Latest list works the same way: newest release on top, no separate "position" field to fall out of sync with it.

an artist uploads from their phone; everyone else just needs the site, never the file

Three ways to shuffle.

RACK: SHUFFLE · THREE MODES
RotationStrict A→B→C. Whoever runs out drops out.
Even spreadProportional to how many tracks each artist has. Never three in a row.
RandomA real Fisher–Yates shuffle. It will clump, and that's the point.

three real modes, picked in the mode menu

Play, skip, queue, favorites, a live waveform.

RACK: DECK · TRANSPORT
  • ▶ play & skip
  • ☰ queue, reorder
  • ⇄ shuffle
  • ♥ favorites

a 250-track queue, a heart for favorites, and a little live waveform drawn from the song itself (no Web Audio, so it keeps playing in the background)

It even works from your lock screen.

RACK: DECK · LOCK SCREEN & THE GUEST LIST
  • 96
  • 128
  • 192
  • 256
  • 384
  • 512

Invite-only, on purpose. Four artists get accounts; everyone else needs a personal link. No public sign-up, ever.

play, pause and skip from your phone's lock screen, artwork included. And it's invite-only: four artists, no public sign-up

RACK F · for the careful reader

Provesserverless edge platform, RFC 9110 byte-range delivery, fail-closed auth, offline audio analysis, profiling-led performance work (résumé → OTD).

RACK: DELIVERY · STATUS CODES
  • 206the slice you asked for, and only that
  • 416past the end: no body, the true size
  • 304unchanged since last time: not re-sent
  • 412changed since your copy: the precondition fails

N-O11 · seeking works because the bytes are right · otd/RESUME-AUDIT.md §11

RACK: ANALYSIS · OFFLINE PIPELINE
  • FFTthe raw file, broken into frequencies
  • ONSETSevery kick, snare and pick, found by hand
  • TEMPOa grid fit to the beat, not assumed
  • CHORDSa chromagram, matched against every key

N-O9 · every track gets its own pass before you ever hit play · otd/RESUME-AUDIT.md §7 #2 #3 #7

RACK: I/O · BYTE RANGES
no Range header200
Content-Length: 10000
Range: bytes=0-1023206
Content-Range: bytes 0-1023/10000
Range: bytes=5000-206
Content-Range: bytes 5000-9999/10000
Range: bytes=-500206
Content-Range: bytes 9500-9999/10000
Range: bytes=11000-416
Content-Range: bytes */10000
If-None-Match: <etag>304
no body

FIG 3.1 · every row is an assertion in otd/test/media.spec.ts against a 10,000-byte object.

CODE 3.1otd/worker/media.ts:161-189
	// Whether this is a partial response is decided from the REQUEST, never from
	// `object.range`. R2 always populates that field — it reports {offset: 0, length:
	// size} both for a genuine `bytes=0-` and for a range it silently declined to
	// apply — so reading it as "a range was applied" turns every plain request into a
	// 206 and every unsatisfiable one into a 206 whose Content-Range contradicts what
	// was asked for. Both were measured against real R2, not assumed.
	const wanted = firstBytePos(request.headers.get('range'), object.size);

	if (wanted !== null && wanted >= object.size) {
		// Starts at or past the end. RFC 9110 requires 416 with the true size, so the
		// client can work out what it should have asked for.
		await object.body.cancel();
		return new Response(null, {
			status: 416,
			headers: { 'Accept-Ranges': 'bytes', 'Content-Range': `bytes */${object.size}` },
		});
	}

	if (wanted === null) {
		// No Range, or one in a form we do not honour. Either way the whole file is a
		// legal answer, and the client can range into it from there.
		headers.set('Content-Length', String(object.size));
		return new Response(object.body, { status: 200, headers });
	}

	const { start, end } = resolveRange(object.range, object.size);
	headers.set('Content-Range', `bytes ${start}-${end}/${object.size}`);
	headers.set('Content-Length', String(end - start + 1));
	return new Response(object.body, { status: 206, headers });
R2 fills in object.range even for a range it declined, so the handler never reads it to decide 206 vs 200. Measured against real R2.
CODE 3.2otd/test/media.spec.ts:93-110
	it('treats bytes=0- as a real partial response covering the whole file', async () => {
		// What every media element sends first. It is a Range request and must answer
		// 206 — a 200 here tells some players the server does not support seeking.
		const res = await call('/api/audio/t1', { headers: { Range: 'bytes=0-' } });
		expect(res.status).toBe(206);
		expect(res.headers.get('content-range')).toBe(`bytes 0-${SIZE - 1}/${SIZE}`);
	});

	it('answers 416 for a range starting past the end, reporting the true size', async () => {
		const res = await call('/api/audio/t1', { headers: { Range: `bytes=${SIZE + 1000}-` } });
		expect(res.status).toBe(416);
		expect(res.headers.get('content-range')).toBe(`bytes */${SIZE}`);
	});

	it('answers 416 for an empty suffix range', async () => {
		const res = await call('/api/audio/t1', { headers: { Range: 'bytes=-0' } });
		expect(res.status).toBe(416);
	});
The two cases a naive handler gets wrong, pinned: bytes=0- must be a 206, and a range past the end must be a 416 with the true size.
RACK: METER · THE 28× FIX
  • 342 ms of blocked main thread per track change, before the fix.
  • The tempo scorer walked every hit for every candidate phase: O(n²) per tempo. Sorting the residuals once makes each count two binary searches, with the identical answer: 28× faster, plus yields between pipeline stages.
  • The wrap-around is the subtle part: a hit 1 ms either side of a gridline must count as close, not a whole step away.
Per second, playing, player open. RESUME-AUDIT.md §7 #8, 2 Sep 2026.
WhatBeforeAfter
ResizeObservers rebuilt3.70
Animation frames cancelled and re-requested7.50
CODE 3.3otd/src/tempo.ts:446-479
	const sorted = (spacing: number) => {
		const out = new Float64Array(hits.length);
		for (let i = 0; i < hits.length; i++) out[i] = ((hits[i] % spacing) + spacing) % spacing;
		return out.sort();
	};

	/** First index whose value is >= `x`. */
	const lowerBound = (arr: Float64Array, x: number) => {
		let lo = 0;
		let hi = arr.length;
		while (lo < hi) {
			const mid = (lo + hi) >> 1;
			if (arr[mid] < x) lo = mid + 1;
			else hi = mid;
		}
		return lo;
	};

	/**
	 * How many residuals sit within `FIT_TOL` of `at`, on a circle of circumference `spacing`.
	 *
	 * The wrap is the part that has to be right: a hit 1 ms after a gridline and one 1 ms before
	 * it are 2 ms apart, not a whole step apart, so a window that runs off either end has to
	 * pick up its remainder from the other. Getting this wrong loses exactly the hits that are
	 * closest to the line, which would look like the fit failing on the tracks it fits best.
	 */
	const within = (arr: Float64Array, at: number, spacing: number) => {
		if (2 * FIT_TOL >= spacing) return arr.length;
		const lo = at - FIT_TOL;
		const hi = at + FIT_TOL;
		if (lo < 0) return arr.length - lowerBound(arr, lo + spacing) + lowerBound(arr, hi);
		if (hi > spacing) return arr.length - lowerBound(arr, lo) + lowerBound(arr, hi - spacing);
		return lowerBound(arr, hi) - lowerBound(arr, lo);
	};
Sorted residuals and a lower-bound search replace the O(n²) scan; the circular window is the part that has to be right.
RACK: GATE · ACCESS

Artists

  1. Cloudflare Access login (SSO)
  2. signed JWT in Cf-Access-Jwt-Assertion
  3. verified against the team JWKS, issuer and audience pinned

Listeners

  1. a per-person invite link, stored only as SHA-256
  2. redeemed for an HMAC-signed HttpOnly cookie; a 302 takes the code out of the URL
  3. signature checked, then the revocation row, on every request

requireIdentity()neither credential → 401 · Access not configured → 503, never open

grantFor()admin · artist · listener, checked server-side on every write; a database error grants listener

Anonymous requests against production. RESUME-AUDIT.md §0, 2 Sep 2026.
RouteStatusWhy
/200The app shell only. No catalog data.
/api/catalog401No credential.
/api/audio/:id401The music itself.
/api/analysis/:id401Notes, chords and beat grid.
RACK: DECK · BUILT FOR A PHONE IN A POCKET
  • One <audio> element that outlives React’s render tree.
  • Lock-screen controls with six artwork sizes (shown above). Features gated by capability probes, never by user-agent sniffing.
  • A failed load retries once, then skips. One bad file can’t end a listening session.
RACK: DECK · NUMBERS, WITH THE DATE THEY WERE COUNTED
test files
36 22 Sep 2026
runtime npm dependencies
5 22 Sep 2026
Worker modules / migrations
14 / 14 22 Sep 2026
components / hooks
33 / 7 22 Sep 2026
median kick-to-gridline error
21.5 → 7.0 ms 2 Sep 2026
artists
4 2 Sep 2026
self-hosted variable fonts
3 · 192 KB 22 Sep 2026

Tests run inside workerd (the Workers runtime) through @cloudflare/vitest-pool-workers, not jsdom.

RACK: DECK · WHAT I DON’T CLAIM
  • No offline mode: there is a web manifest and no service worker.
  • No playlists. It has a queue: drag reorder, play next, cross-device resume.
  • No adaptive bitrate. Two fixed tiers, chosen at load, delivered by byte ranges.
  • No load test, uptime figure or user count. None has been measured.
  • It is anti-discovery, not DRM. Anyone who can hear the music can record it.
  • The demo above is silent on purpose: the site ships no audio, only OTD’s analysis files for two tracks.

Source: otd/RESUME-AUDIT.md §12, 2 Sep 2026.

RACK: DECK · STACK
  • React 19
  • TypeScript
  • Cloudflare Workers
  • D1 (SQLite)
  • R2
  • Hono
  • Vitest in workerd
  • Canvas 2D

← Back to the desk