AI RADIO JOCKEY FOR BLR NOW


DA3: AI Radio Jockey — 3-Container Architecture

Name of the DA3:

AI Radio Jockey (AI-RJ) — DA3

BY: Kaustubh



Introduction

This DA (Design Assignment) implements an automated AI Radio Jockey pipeline running in three containers: a News Fetcher + Gemini script generator, an Audio Mixer (TTS + mixer), and an Icecast streaming server. The system continuously pulls news from Firestore, converts it into conversational RJ-style scripts using the Gemini API, synthesizes voice and mixes it with music beds/jingles, and streams the final audio via Icecast.


Objectives

Objectives of Part 1 — News Fetcher & Script Generator

  • Continuously fetch latest news items from Firestore.

  • Normalize and filter news by category and recency.

  • Send news text to the Gemini API (or other LLM) to generate RJ-style voice scripts, transitions, and metadata (segment id, estimated length, tone).

  • Save results to a shared location (shared volume, HTTP endpoint, or message queue) for the Mixer to pick up.

  • Provide robust error handling and fallback scripts.

Objectives of Part 2 — Mixer (TTS + Audio Engine)

  • Convert Gemini-generated scripts to speech (TTS engine of choice).

  • Mix synthesized voice with background music, jingles, and effects using FFmpeg/GStreamer.

  • Normalize loudness, insert transition fades and metadata updates.

  • Stream or push finalized audio segments to Icecast (live source) and update now-playing metadata.

  • Expose health/status endpoints and logs for monitoring.

Objectives of Part 3 — Icecast Streaming Server

  • Accept live audio source(s) from the Mixer.

  • Broadcast the stream over HTTP (MP3/OGG) with stable mount points.

  • Provide an admin interface to view live connections and update metadata.

  • Allow public or restricted access depending on configuration.


Name of the containers involved and the download links

  1. news_gen — News Fetcher + Gemini integration

    • Suggested Docker Hub / GitHub starter: gh:your-org/ai-rj-news-gen (create your repository)

    • Example base images: python:3.11-slim or node:20-slim depending on implementation.

  2. mixer — TTS + Audio Mixer

    • Suggested Docker Hub / GitHub starter: gh:your-org/ai-rj-mixer

    • Key runtime: python:3.11-slim plus ffmpeg package in image.

  3. icecast — Icecast streaming server


Name of the other software involved and the purpose

  • Google Firestore — Source of news documents (title, body, timestamp, tags).

  • Gemini API (or chosen LLM) — Generate RJ-style text scripts and suggested metadata.

  • TTS engine — Convert text → speech. Options: Gemini TTS, ElevenLabs, Amazon Polly, Coqui, or open-source gTTS as fallback.

  • FFmpeg / GStreamer / SoX — Audio mixing, normalization, conversion, and streaming to Icecast.

  • Docker & Docker Compose — Container orchestration for local development.

  • NGINX (optional) — Reverse proxy / TLS termination for Icecast admin web UI.

  • Prometheus + Grafana (optional) — Monitoring and logs metric visualization.

  • git / GitHub — Source control and CI/CD (build/push images to Docker Hub).


Overall architecture of all three DAs


Two-paragraph architecture description

The AI Radio Jockey pipeline is a modular three-container system that separates concerns: content acquisition and preparation (news_gen), audio production (mixer), and distribution (Icecast). news_gen is responsible for listening to Firestore changes, transforming raw news into conversational scripts through the Gemini API, and producing segment metadata (duration, priority, tags). This output is written to a shared artifact store (either a mounted shared volume or an internal HTTP endpoint) that the mixer periodically polls.

The mixer converts scripts to speech using a chosen TTS engine and stitches the voice with music beds, jingles, and effects using FFmpeg. The mixer also normalizes loudness and publishes metadata updates. Finally, the icecast container accepts the live audio source (pushed by FFmpeg) and provides a stable HTTP-based streaming endpoint to listeners. By splitting responsibilities into containers, each part can be scaled independently, replaced, or developed/tested in isolation.


Procedure — Part 1 (News Fetcher + Script Generator)

High-level steps:

  1. git clone https://github.com/Kaustubh2k5/Radio_jockey_BLRNOW.git

  2. docker build -t ai-rj-news-gen:latest .
  3. docker run --name news_gen \ -v $(pwd)/shared:/app/shared \ -v $(pwd)/keys:/app/keys \ai-rj-news-gen
  4. docker logs news_gen

Screenshots:



Procedure — Part 2 (Mixer)

High-level steps:

  1. cd mixer

  2. docker build -t ai-rj-mixer:latest .

  3. docker run --name mixer \

      -v $(pwd)/../shared:/app/shared \

      -v $(pwd)/../music:/app/music \

      -v $(pwd)/../outputs:/app/outputs \

      ai-rj-mixer

  4. docker logs mixer

Screenshots:


Procedure — Part 3 (TRANSCRIPT+AUDIO+Icecast)

High-level steps:

  1. Pull official Icecast image: docker pull infiniteproject/icecast

  2. Provide icecast.xml (or environment variables) with passwords and mount points.

  3. Expose port 8000 on the host for listener access.

  4. Start Icecast and navigate to http://localhost:8000 to confirm the admin UI.

  5. Confirm the Mixer can push to the /radio mount and that the stream plays.

Screenshots:





What modification is done in the containers after downloading — step by step

  1. news-gen:

    • Added Firestore credentials mount and configuration parsing.

    • Implemented Gemini API call with templated prompt that enforces RJ tone and segment length.

    • Added retry/backoff and fallback script generator.

    • Output: /shared/scripts/{segment_id}.json with fields script, estimated_duration, tags, priority, timestamp.

  2. mixer:

    • Installed ffmpeg in the image and added Python script to orchestrate TTS and audio mixing.

    • Implemented loudness normalization using ffmpeg -af loudnorm.

    • Implemented an Icecast push wrapper and now-playing metadata POST to Icecast's admin API.

  3. icecast:

    • Provided a custom icecast.xml with secure passwords and proper mount point configuration.

    • Taught the admin UI to accept referer headers when behind an Nginx reverse proxy.


GitHub link / DockerHub link of your modified containers

Replace your-org below with your GitHub/DockerHub org name after you push.

  • AI JOCKY News generator repo: https://github.com/Kaustubh2k5/Radio_jockey_BLRNOW


What are the outcomes of your DA?

  • Automated pipeline that converts live Firestore news into RJ-style audio segments.

  • A continuously streaming Icecast endpoint listeners can tune into.

  • Configurable scheduling and fallback scripts to provide uninterrupted streaming.

  • Modular containers that can be updated independently (e.g., swap TTS engine without touching Firestore logic).


Conclusion

This DA demonstrates a practical, modular approach to building an AI-driven internet radio host. It effectively combines cloud-based data sources, AI text generation, and audio processing technologies to create an automated, scalable radio broadcasting system. The architecture’s modular design enables independent updates and enhancements, ensuring flexibility for future integrations such as multilingual TTS, real-time listener interactions, and sentiment-based content modulation.

Through this implementation, we achieved an efficient end-to-end system capable of autonomously generating, processing, and streaming radio content. The DA highlights how containerized AI-driven pipelines can bridge the gap between automated content creation and real-world multimedia broadcasting, setting a foundation for future smart radio applications.

Comments