cd /news/ai-agents/my-ai-agent-built-a-24-7-music-strea… · home › topics › ai-agents › article
[ARTICLE · art-163098] src=blakelapierre.substack.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

My AI Agent Built a 24/7 Music Stream That Chat Controls. In the Logs, Every Vote Was Mine.

A developer built a 24/7 YouTube live stream of procedurally generated music, with a Python engine writing audio in real time and ffmpeg encoding it into a 720p video, while chat commands let viewers vote on the next style, mood or lead instrument. In two test broadcasts, the chat logs recorded three votes, all cast by the developer himself. The agent has since expanded the system to 22 toggleable features, including 17 styles, seed-based composition and a chat-driven hype meter.

read5 min views1 publishedNov 3, 2026
My AI Agent Built a 24/7 Music Stream That Chat Controls. In the Logs, Every Vote Was Mine.
Image: Blakelapierre (auto-discovered)

Previously: Bonus: I’m Building a Peer-to-Peer Game Planet in the Browser With Grok’s Build Mode Back to the roster. The last regular post was my consulting agent. This one is my streaming audio agent, the one in post 1 building “a live stream that chat controls.”

The idea: a YouTube live stream of music that never ends and never repeats, like the lo-fi “beats to study to” channels. The difference is that nothing is recorded. Every drum hit, bass note and chord is generated by Python code in real time, and the people in chat decide where it goes next.

How it works #

There are two programs.

  • The music engine writes raw audio, paced to real time. It plays sections of about 2.5 to 4 minutes, and each one drifts to a new style, key, mode and tempo. Chords use voice leading so changes sound smooth, and one section fades into the next instead of cutting.
  • ffmpeg (the standard open-source video tool) turns that audio into a 720p video and sends it to YouTube. The video is a big style banner, a waveform and a scrolling spectrogram, plus text lines that update from small files.

A third, optional program reads the live chat through YouTube’s official API with a read-only key. It’s set up to only listen. Posting to chat is turned off.

The music engine is cheap. The agent measured every style at about 4 to 8 percent of one CPU core. Encoding the video takes about one core. No graphics card needed.

The test nights #

The logs on my agents’ shared computer cover two test broadcasts, both titled “Programming Music.”

The first, on Oct 2 a little after 2 AM, didn’t even connect at first. The usual YouTube streaming port timed out from that machine, so the agent switched to the encrypted address on port 443, the one that works when only web traffic is allowed out. It’s still the default.

The second was on the evening of Oct 3. The stream ran with three styles (lo-fi, ambient and chill electronic) and a vote line on screen. I typed !ambient in chat, changed my mind about three minutes later and typed !chill. The latest vote counts, so when the round closed, the next section was “chill electronic, chosen by vote.”

That’s the honest part of this post: across both nights the chat logs hold 3 votes, and all 3 are mine. A stream that chat controls needs a chat.

The original version, at 144p (YouTube’s lowest quality): three styles, a vote tally and a countdown to the next pick.

Then it kept building #

Right after that test, the agent wrote up what other 24/7 streams do (Lofi Girl, Chillhop, freeCodeCamp’s Code Radio, focus-music apps) and proposed new instruments and chat commands, with prototype audio for each. Then it built them, one numbered feature at a time, each one with a switch to turn it off. There are 22 now. Some highlights:

  • 17 styles. Lo-fi, ambient, chill electronic, chillhop, synthwave, dub techno, liquid drum and bass, bossa lo-fi, trip-hop, city pop and glitch, plus six blends like “jazz-hop” and “koto trip-hop.” The instruments are synthesized too: a plucked guitar and a sitar built from string models, marimba, kalimba, steel pan, a muted trumpet, a supersaw synth and an 808 bass.
  • Chat commands. Vote the next style, the mood or the lead instrument.!drop sets up a build and a drop, but only when two different people ask within two minutes.!break pulls the drums out for two bars.
  • Seeds.!seed coffee turns a word into the next section’s key, tempo, chords and melody. The same word always gives the same tune, and every section shows its seed, so you can bring back one you liked.
  • A hype meter. The busier chat gets, the denser the drums and the brighter the sound.
  • Shout-outs and a listener board. Your name goes on screen when you vote, with a filter for bad names, and a board ranks who’s been listening (chatting) the longest.
  • A sky that follows Los Angeles. The background shifts from night to dawn to day to dusk with the real sun, and the agent checked that the text stays readable at every hour.
  • Focus mode. A gentle pulse locked to the beat, with minimal drums. The agent made a point of putting no health claims on screen.

It plans around YouTube’s limits #

The part I didn’t expect to care about is the quota. YouTube’s API gives a project a default of 10,000 units a day, and reading chat costs about 5 units each time. So the agent paces itself: about every 20 seconds while chat is busy, 55 seconds normally, and 2 minutes when nobody has spoken for 10 minutes. It always keeps enough to last until midnight Pacific.

It didn’t just say that. It wrote a test that simulates a full day under different chat patterns, viewer-count checks included. The worst case it found uses 9,550 of the 10,000 units.

It also shows its delay. A line on screen estimates how long it takes for a chat message to change the music, and a countdown says when the next chat check happens, so a viewer knows whether their vote will make it.

The current layout in a test render. The names, viewer count and loves here are made-up test data, not real viewers.

What I learned #

  • Generated beats licensed. No samples and no copyrighted tracks means no takedowns and nothing to license. The code is the music.
  • Constraints make good engineering. The quota and the 144p screen shaped almost every design choice, from the polling pace to the giant text.
  • Every feature gets an off switch. With all 22 turned off, it behaves like the original 3-style stream. That made it safe to keep adding.
  • Features don’t bring viewers. The agent can build a seed system and a listener board. It can’t make anyone show up. That part is still my job, and so far I haven’t done it.

Next up is the last agent on the roster: web radio.

— Blake (written through my AI agents)

*Previously: [Bonus: I’m Building a Peer-to-Peer Game Planet in the Browser With Grok’s Build Mode](https://blakelapierre.substack.com/p/bonus-im-building-a-peer-to-peer)*
── more in #ai-agents 4 stories · sorted by recency
── more on @youtube 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-ai-agent-built-a-…] indexed:0 read:5min 2026-11-03 · —