Skip to content
◆ Nivoice/README.md·~/projects/nivoice
● Twitch tool

Nivoice

role year 2026

A self-hosted Twitch platform that reads channel-point messages out loud in character voices, with a talking head on the stream overlay.

Node.jsExpressSocket.ioPythonFastAPIQwen3-TTSSQLiteThree.jsDocker

Nivoice started with me testing open-source TTS models like Qwen3-TTS and looking into fine-tuning custom voices. Then one thing led to another, and it turned into an "I wonder if I could do this kind of thing" project.

What came out is a self-hosted platform for Twitch streamers. A viewer redeems channel points, types a message, and it gets read out on stream in a character's voice. Alerts, sound rewards, a chat bot and a Spotify now-playing bar came along too. A streamer logs in with Twitch and pastes one overlay URL into OBS. That's the setup on their end.

And the funny part: I don't even use it. I like building software with the idea of other people using it, if it's something they'd be interested in. So it's multi-user from the start. One install serves any number of streamers, each with their own voices, sounds and overlay.

The Nivoice dashboard with redemption stats, the hidden OBS browser source URL, a voice breakdown chart and a discovery feed of Twitch rewards.
The dashboard. The discovery feed pulls in channel-point rewards from Twitch so you can turn them into TTS or sound rewards.

Talking heads, South Park style

My favourite bit is where the whole TTS pipeline ends up: a character on screen, moving their head while they talk. I saw someone with something like it and thought it was quite funny.

There's no lip-sync model behind it. The overlay cuts the character image in two at the mouth line. While the audio plays, an analyser reads how loud the voice is, and the top half of the head lifts and tilts by that much. Louder voice, wider mouth.

public/overlay.html
1function drawChar(img, mouthY, openAmt, rotation) {
2 const w = img.naturalWidth, h = img.naturalHeight;
3 const splitPx = Math.round(mouthY * h);
4 canvas.width = w;
5 canvas.height = h + MAX_OPEN_PX;
6 ctx.clearRect(0, 0, w, canvas.height);
7 ctx.drawImage(img, 0, splitPx, w, h - splitPx, 0, splitPx + MAX_OPEN_PX, w, h - splitPx);
8 const pivotX = w / 2;
9 const pivotY = splitPx + MAX_OPEN_PX;
10 ctx.save();
11 ctx.translate(pivotX, pivotY);
12 ctx.rotate(rotation);
13 ctx.drawImage(img, 0, 0, w, splitPx, -w / 2, -splitPx - openAmt, w, splitPx);
14 ctx.restore();
15}

The bottom half stays put. The top half gets drawn rotated around the mouth line and pushed up by openAmt. Each character has its own mouthY, so the cut lands in the right spot. The mouth opens up to 50 px, and every 10 frames the head picks a new random tilt, scaled by how open the mouth is.

More training made the voices worse

The hard part wasn't connecting everything. It was the TTS itself.

I trained the custom voices in a separate project on my desktop's RTX 5080. I had some problems fine-tuning on it, and I think Blackwell still has some bugs there. The weirdest one: training for a lot of epochs turned the voice models into just a lot of noise. It was really weird. After a lot of research I found people saying a few epochs would work, so I tried that, and the voices came out much better.

Running the voices happens on a different machine. My homelab has an RTX 2070 Super with 8 GB of VRAM, and that sets the rules. With trial and error and some calculating, I landed on a hard cap of three warm voices, which is about 6.4 GB. A fourth runs out of memory. The TTS server keeps the three most recently used voices on the GPU and moves the rest to the CPU until someone asks for them.

gotcha

flash_attention_2 is off the table on the 2070 Super, because it's a Turing card. The TTS container runs with NIVOICE_ATTN_IMPL=sdpa instead.

note

Every message passes a hardcoded blocklist before it reaches the TTS. It undoes leetspeak and collapses repeated letters before matching, and it can't be turned off from the admin page. Only a code change removes a word.

Spotify rate-limited me

The now-playing bar asks Spotify what's playing. I asked too often, Spotify rate-limited me, and the overlay died.

The fix came in steps. First, back off when Spotify answers with a 429 or a 5xx instead of hammering it. Then poll smarter: only while an overlay is actually open, faster during a track, and once more right before the track ends so the next song shows up on time.

The day after, I added Bring Your Own App. Each streamer registers their own Spotify Client ID and Secret, so each one gets their own rate limit. The idea is that if a lot of people used it, the limit still wouldn't get hit.

How it runs

It's three Docker containers on my homelab. The Node app handles Twitch login, the dashboard, the chat bot and the overlays over Socket.io. The FastAPI server runs Qwen3-TTS on the GPU. And an nginx container serves the admin UI for the voices.

OBS doesn't log in. Each streamer gets an overlay URL with their own token in it, which they can regenerate if it leaks. Twitch and Spotify tokens are encrypted before they go into the SQLite database.

A sub bomb alert on the overlay: the name TestGifter in big outlined letters above a pile of pink 3D gift boxes.
A test sub bomb alert. Each alert type gets its own 3D effect, rendered with Three.js.

What's next

wip

It's parked for now, and I don't use it myself. But it's built so other streamers could sign in with Twitch and use it, if it's something they'd be interested in.