{"slug": "my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote", "title": "My AI Agent Built a 24/7 Music Stream That Chat Controls. In the Logs, Every Vote Was Mine.", "summary": "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.", "body_md": "*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)*\n\nBack to the roster. The last regular post was my [consulting agent](https://blakelapierre.substack.com/p/my-ai-agent-works-inside-a-clients). This one is my **streaming audio agent**, the one in [post 1](https://blakelapierre.substack.com/p/i-run-my-one-person-business-with) building “a live stream that chat controls.”\n\nThe 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.\n\n## How it works\n\nThere are two programs.\n\n- **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.\n- **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.\n\nA 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.\n\nThe 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.\n\n## The test nights\n\nThe logs on my agents’ shared computer cover two test broadcasts, both titled “Programming Music.”\n\nThe 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.\n\nThe 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.”\n\nThat’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.\n\n*The original version, at 144p (YouTube’s lowest quality): three styles, a vote tally and a countdown to the next pick.*\n\n## Then it kept building\n\nRight 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:\n\n- **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.\n- **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.\n- **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.\n- **A hype meter.** The busier chat gets, the denser the drums and the brighter the sound.\n- **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.\n- **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.\n- **Focus mode.** A gentle pulse locked to the beat, with minimal drums. The agent made a point of putting no health claims on screen.\n\n## It plans around YouTube’s limits\n\nThe 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.\n\nIt 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.\n\nIt 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.\n\n*The current layout in a test render. The names, viewer count and loves here are made-up test data, not real viewers.*\n\n## What I learned\n\n- **Generated beats licensed.** No samples and no copyrighted tracks means no takedowns and nothing to license. The code is the music.\n- **Constraints make good engineering.** The quota and the 144p screen shaped almost every design choice, from the polling pace to the giant text.\n- **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.\n- **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.\n\nNext up is the last agent on the roster: web radio.\n\n— Blake (written through my AI agents)\n\n*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)*", "url": "https://wpnews.pro/news/my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote", "canonical_source": "https://blakelapierre.substack.com/p/my-ai-agent-built-a-247-music-stream", "published_at": "2026-11-03 11:36:46+00:00", "updated_at": "2026-11-03 12:26:40.514120+00:00", "lang": "en", "topics": ["ai-agents", "generative-ai", "ai-tools"], "entities": ["YouTube", "ffmpeg", "Python", "Lofi Girl", "Chillhop", "freeCodeCamp"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote", "markdown": "https://wpnews.pro/news/my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote.md", "text": "https://wpnews.pro/news/my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote.txt", "jsonld": "https://wpnews.pro/news/my-ai-agent-built-a-24-7-music-stream-that-chat-controls-in-the-logs-every-vote.jsonld"}}