From 25cb00293671e9e9aabb1f3e34cf637248da7093 Mon Sep 17 00:00:00 2001 From: BryanMurphy <123925276+BPMData@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:37:24 -0500 Subject: [PATCH 1/2] WAV writer failback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The audio is now rendered against the film’s cues. Adds a built-in WAV writer for players that don’t have one. --- .claude/launch.json | 11 +++++++++++ tools/html_to_mp4.py | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .claude/launch.json diff --git a/.claude/launch.json b/.claude/launch.json new file mode 100644 index 0000000..089d538 --- /dev/null +++ b/.claude/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.0.1", + "configurations": [ + { + "name": "cse-loop", + "runtimeExecutable": "python3", + "runtimeArgs": ["-m", "http.server", "8765", "--bind", "127.0.0.1", "--directory", "proj/cse-loop"], + "port": 8765 + } + ] +} diff --git a/tools/html_to_mp4.py b/tools/html_to_mp4.py index d3a41e4..ae0309e 100644 --- a/tools/html_to_mp4.py +++ b/tools/html_to_mp4.py @@ -89,7 +89,15 @@ FILM_AUDIO_JS = r""" () => { eval(document.getElementById('dhs-audio-src').textContent); - const r = DHS.audio.render(), b = new Uint8Array(DHS.audio.wav(r.master, r.sr, 16)); let s = ''; + const cues = (DHS.film.tl || DHS.film.build()).cues, r = DHS.audio.render({ cues }); + const wav16 = (m, sr) => { // players whose DHS.audio has no .wav(): write a 16-bit stereo WAV here + const n = m.L.length, v = new DataView(new ArrayBuffer(44 + n * 4)), u = (o, t) => { for (let i = 0; i < t.length; i++) v.setUint8(o + i, t.charCodeAt(i)); }; + u(0, 'RIFF'); v.setUint32(4, 36 + n * 4, true); u(8, 'WAVEfmt '); v.setUint32(16, 16, true); v.setUint16(20, 1, true); v.setUint16(22, 2, true); + v.setUint32(24, sr, true); v.setUint32(28, sr * 4, true); v.setUint16(32, 4, true); v.setUint16(34, 16, true); u(36, 'data'); v.setUint32(40, n * 4, true); + const q = (x) => Math.max(-32768, Math.min(32767, Math.round(x * 32767))); + for (let i = 0; i < n; i++) { v.setInt16(44 + i * 4, q(m.L[i]), true); v.setInt16(46 + i * 4, q(m.R[i]), true); } + return v.buffer; }; + const b = new Uint8Array(DHS.audio.wav ? DHS.audio.wav(r.master, r.sr, 16) : wav16(r.master, r.sr)); let s = ''; for (let i = 0; i < b.length; i += 0x8000) s += String.fromCharCode.apply(null, b.subarray(i, i + 0x8000)); return btoa(s); } """ From a466db2adb1a3314e10c49812161a58dce64a687 Mon Sep 17 00:00:00 2001 From: BryanMurphy <123925276+BPMData@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:39:15 -0500 Subject: [PATCH 2/2] =?UTF-8?q?WAV=20writer=20failbacThe=20audio=20is=20no?= =?UTF-8?q?w=20rendered=20against=20the=20film=E2=80=99s=20cues.=20=20A=20?= =?UTF-8?q?built-in=20WAV=20writer=20for=20players=20that=20don=E2=80=99t?= =?UTF-8?q?=20have=20one.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The audio is now rendered against the film’s cues. A built-in WAV writer for players that don’t have one. --- .claude/launch.json | 11 ----------- .gitignore | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 .claude/launch.json diff --git a/.claude/launch.json b/.claude/launch.json deleted file mode 100644 index 089d538..0000000 --- a/.claude/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.0.1", - "configurations": [ - { - "name": "cse-loop", - "runtimeExecutable": "python3", - "runtimeArgs": ["-m", "http.server", "8765", "--bind", "127.0.0.1", "--directory", "proj/cse-loop"], - "port": 8765 - } - ] -} diff --git a/.gitignore b/.gitignore index 08f16c1..b23a6cf 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ MakeCode/ # Bryan's own copy of the Maker Bench version (not published; Pages serves the whole repo) proj/cse-loop/cse-loop-maker.html + +# Claude desktop app preview config (local only) +.claude/launch.json