Skip to content
qrbni.dev
← Blog

Jake: a local AI news anchor I run in OBS

How I built Jake — a three.js news host with local Piper TTS — and got him talking in OBS with scene cuts, after the GPU path and Browser Source audio both failed on this machine.

·6 min read·
#jake#three.js#piper#tts#obs#case-study

Jake is a 3D news anchor I run on my laptop. He sits in OBS, reads a rundown, and cuts between studio scenes while he talks. The voice is Piper, synthesized locally. The picture is a three.js page in an OBS Browser Source. This is a case study of that pipeline, and of the dead ends I hit on the way.

The problem

I wanted a host for a news-style OBS show: a studio background, a lower third, a page or graphic behind him, and scene cuts that follow the script. The voice had to stay on the machine. I did not want a cloud avatar API in the middle of the path.

On this laptop that is a tighter constraint than it sounds. The GPU is a Pascal GTX 1050. Current CUDA / cuDNN / onnxruntime-gpu builds do not support it, so a "just run TTS on the GPU" plan was not a given.

The setup

A local Node server listens on 127.0.0.1:8787, bound to localhost so the page and the unauthenticated API are not on the LAN.

A request hits POST /say or POST /scenario. The server splits the text into sentences and sends all of them to a pool of persistent Piper workers (default two). Piper 1.8 runs with include_alignments=True, so each sentence comes back as raw PCM plus per-phoneme timings. visemes.mjs maps those espeak IPA phonemes to Character Creator mouth morphs.

From there the server fans out:

  • Picture: a WebSocket drives the three.js page (jake.js) inside an OBS Browser Source called "Jake Browser". It renders at 854×480 and 24 fps with a transparent background, so the studio shows through.
  • Voice: audio skips the Browser Source. The server mixes it in memory, encodes it as AAC, and streams it over local UDP to an OBS Media Source called "Jake Voice".
  • Studio control: obs-websocket sets the lower third and background page, and switches the program scene when a line asks for it.

The talking scenes reuse those inputs: News Studio (Jake in front of the desk), News Two Column (Jake left, a TV frame right), and News Fullscreen (page full-frame, Jake in the corner). The default lower third is "Jake — AI host".

A rundown is JSON. Each line can carry emotion, a short action (nod, tilt, look), a pause, and an OBS scene to cut to when that line starts. One ready-to-play fixture is scenarios/full-news.json. OBS can record or send the result to Owncast.

What I tried

TTS on the GTX 1050. A TTS_DEVICE=cuda path would use a CUDA 12 onnxruntime-gpu build; CUDA 13 builds do not support this Pascal card. That GPU venv was never the running setup, and I later removed it. cuda already fell back to CPU if the venv was missing. The CPU venv (onnxruntime 1.31.1) is what actually speaks.

Letting OBS carry the audio from the Browser Source. OBS 33 renders the three.js page fine, but on this machine the Browser Source passes no audio. I gave the voice its own feed.

Capturing the whole page as video. An older path still exists: hidden headless Chrome, CDP frames, H.264, then UDP (CAPTURE_MODE=video). It is how I used to get Jake into OBS, and it still works, but it is heavier than I need. The default is now audio-only: OBS composites the live Browser Source, and the server only supplies the voice.

Relying on the model's built-in "Open" morph. Character Creator's Open viseme is subtle on this figure, and the CC_Base_JawRoot bone barely moves the skin. Driving only Open did not read as speech.

What worked

Synthesis is decoupled from playback. As soon as a request arrives, every sentence goes to the Piper pool, even if Jake is still mid-line. Playback stays in request order and starts when the first sentence is ready. In the current CPU setup that first sentence is typically ready in about 0.4–0.5 seconds; later sentences are usually already waiting. Audio never touches the disk: workers return PCM over stdout, the capture bridge mixes the buffer, and repeated sentences come from a small LRU cache.

The picture and the voice leave the server on the same clock. In OBS recordings (a page marker against voice onset) the voice is 0 to 40 ms after the mouth starts, mean about +20 ms — within one frame at 24 fps — so no A/V offset is applied.

For the mouth, Piper's phoneme alignments map to the CC visemes I actually have, weighted by loudness, and the page adds Mouth_Open for open vowels on top of CC Open. Blinks, emotion morphs, lowered arms, breathing, and eye saccades sit on the same character.

A rundown with per-line scene values is enough to cut across the news scenes as he talks. In Studio Mode, /scenario sets the program scene directly and leaves Preview alone.

The request shape is small. This is the TypeScript type the /scenario API accepts — not a guessed implementation:

interface ScenarioLine {
  text: string;
  emotion?: Emotion;
  actions?: Action[];
  pauseAfterMs?: number;
  scene?: string; // OBS program scene, switched when this line starts
}

interface ScenarioBody {
  lines: ScenarioLine[];
  title?: string;
  source?: string; // article URL, used as the background if nothing else is set
  obs?: { scene?: string; lowerThird?: string; background?: Background };
}

I queue a finished rundown with node app/play.mjs scenarios/full-news.json.

A related experiment: Unity

In parallel I started a Unity live-show prototype (unity-caster, Unity 6000.3.28f1). It is not Jake in a different engine. Three placeholder characters — Rosa, Milo, and Kai — sit around a table, take turns, and cut between a wide shot and close-ups. A small HTTP endpoint on 127.0.0.1:8790 can send a line in Play mode, and the placeholders are built to be swapped for VRoid models later without changing the control code. Lip-sync there is still an open step. On this hybrid laptop, Unity rendered on the AMD integrated GPU, not the GTX 1050.

Takeaways

  • Measure the hardware you have. A Pascal GTX 1050 is still a fine capture encoder — NVENC is what OBS uses here — but it is not a safe bet for current CUDA TTS builds. The CPU path, with sentence-level prefetch, was good enough to start talking in about half a second.
  • If OBS Browser Source is silent on your machine, do not keep debugging the page. Give the voice its own low-delay path and clock it with the animation on the server.
  • Lip-sync is model-specific. Phoneme timings from Piper were the right input; the Character Creator morphs still needed extra work before the mouth looked like speech.
  • A rundown with per-line scene cuts is a better control plane than a pile of OBS hotkeys. The JSON is the show.