Tag Archives: nightdialtv

Why Night Mode Audio in Night Dial TV Doesn’t Use Web Audio

Late-night channel surfing through random Internet Archive uploads comes with one big annoyance: the volume swings. You turn the set up so you can actually hear muffled 1940s Suspense dialogue, and two minutes later a crusty VHS transfer or 1980s commercial break rattles the windows.

When I added Night DRC to the Picture & CRT drawer in Night Dial TV, I started where anyone building browser audio night start: the Web Audio API. Hook the <video> element into createMediaElementSource(), throw a DynamicsCompressorNode and a couple of EQ filters in line, and call it done.

I found out that when I did that, it muted half the guide.

Archive.org links don’t serve media straight from the main domain. They 302-redirect out to distributed storage nodes, and plenty of those storage mirrors don’t send Access-Control-Allow-Origin headers on the redirected file.
If you attach a <video> element to a Web Audio graph without valid CORS headers, browser security rules silently zero out the audio samples. The video keeps playing, the scrub bar keeps moving, and your speakers go completely dead.

Rather than intercepting raw PCM audio through an AudioContext, Night Dial TV uses a lightweight volume envelope (startDrcLevelerLoop) that adjusts video.volume directly. Because it never touches crossOrigin or MediaElementSourceNode, every Archive mirror plays without a hitch.

Clicking NIGHT DRC cycles through three settings:
* NIGHT DRC: OFF (Full Range): Stops the loop and puts video.volume back to your normal ceiling (drcUserCeiling).
* NIGHT DRC: LEVEL (Late-Night Leveler): Keeps output around 76% of your ceiling with a slow, subtle ride (±4%) so jumping between loud and quiet channels doesn’t wake up the house.
* NIGHT DRC: VOICE (OTR Voice Clarity): Lifts the floor to 86% of your ceiling with a tighter ride (±3%), keeping old-time radio and muddy film dialogue readable when you’ve got the master volume turned way down.

Stepping video.volume in hard increments sounds awful, so the loop eases toward its target on each requestAnimationFrame tick using an exponential curve (\alpha = 1 – e^{-\Delta t \cdot 4.5}).

It also has to get out of the way when you touch the rest of the console:

* Manual volume changes: Turning Night DRC on snapshots your current volume as drcUserCeiling. If you hit VOL + / VOL − on the remote or drag the player’s volume slider while DRC is running, the volumechange listener catches any change larger than 0.015 from drcLastAppliedVol and updates your ceiling to match.

* Sleep timer fade-out: Once the VCR deck’s Sleep Dial hits its final 30-second fade (isSleepFading), the DRC loop backs off completely so the audio can fade down to zero before the CRT clicks off.

For me, the right fix for browser audio isn’t a DSP chain at all-it’s just riding the volume knob gently and knowing when to let go.