The Bilingual Story Engine: Crafting Audio for My Son with the Gemini API

The Bilingual Story Engine: Crafting Audio for My Son with the Gemini API

This is a submission for the Google AI Studio Multimodal Challenge

What I Built

As a father of a young bilingual child, I’m constantly searching for high-quality, age-appropriate audio content that can support his language development in a fun and engaging way. Finding materials that are just right—not too complex, available in the right languages, and genuinely entertaining—is a significant challenge. This personal need was the inspiration for the AI Bilingual Podcast Generator.

I built this application to empower parents, educators, and creators to produce short, engaging, and educational audio content for children. It solves the problem of a lack of easily accessible, customizable, and multilingual educational materials for kids by putting a powerful content creation studio into their hands.

The applet allows a user to specify a topic, choose a podcast format, select target languages, and define an age range. From these inputs, it orchestrates a multi-step AI pipeline to generate a complete, full-cast "radio play" or podcast episode, complete with music, sound effects, and multiple AI-generated voices.

To cater to different learning needs, the generator features three distinct modes, each grounded in principles of bilingual pedagogy:

  1. Story + Explore: This mode is based on Content and Language Integrated Learning (CLIL). It first tells an engaging story in the child’s primary language (L1) to establish context and capture their imagination. It then transitions to a non-fiction "deep dive" on a related topic either the same or a second language (L2). This leverages the child’s understanding of the story as a scaffold to introduce new concepts and vocabulary in L2 in a meaningful, curiosity-driven way.

  2. Story + Language: This mode offers a more direct approach to language acquisition. After the story in L1, it provides a fun, focused language lesson in L2, centered on key vocabulary from the narrative. This reinforces the connection between the two languages and helps build a concrete vocabulary bridge, making language learning explicit and immediately relevant to the content they just enjoyed.

  3. Why Podcast: This mode is designed for monolingual deep dives that provide rich, comprehensible input. By answering a child’s natural "why" questions in a simple, engaging format, it helps build a strong conceptual and linguistic foundation in a single language. For bilingual children, this is crucial for strengthening proficiency and confidence in one of their languages, which is a key part of balanced bilingual development.

The experience is designed to be simple and intuitive. A user fills out a single form, clicks "Generate," and watches as the AI performs the complex tasks of scriptwriting, voice casting, performance direction, and audio synthesis, culminating in a downloadable WAV and MP3 file.

Demo

A live demo of the applet can be found here: https://wip-radio-play-bilingual-podcast-generator-202507-732586558049.us-west1.run.app/

How I Used Google AI Studio

This applet is built entirely in AI Studio using the capabilities of the Gemini API, leveraging several models for a sophisticated, chained generation process.

  1. Script Generation (gemini-2.5-pro): The process begins by using a powerful text model to generate the podcast’s narrative. I provided a highly detailed system prompt outlining the persona (an expert in children’s content), the desired structure, and strict rules for the output. The crucial feature here was responseSchema, which forced the model to return a perfectly formatted JSON object representing the script, including characters, dialogue segments, and system cues (like intro_music). This structured output is the backbone of the entire automated pipeline.

  2. Voice Casting (gemini-2.5-flash): To make the podcast engaging, different characters need distinct voices. I created an "AI Casting Director" prompt that provides the full script text to a fast model. The model analyzes the characters’ dialogue and personalities to select the most appropriate voice actors from a predefined list of available TTS voices. Again, this uses responseSchema to ensure the output is a structured list of character-to-voice assignments.

  3. Performance Direction (gemini-2.5-flash): To avoid robotic-sounding dialogue, I use an "AI Vocal Director" prompt. This prompt iterates through each line of the script, asking the model to add parenthetical performance notes (e.g., "(excitedly, leaning in closer)") based on the context of the full story. This adds a layer of emotional depth to the text before it’s sent for audio generation.

  4. Text-to-Speech (gemini-2.5-pro-preview-tts): This is the core multimodal feature. The final, directed script is converted from text to audio. I make extensive use of the multi-speaker voice generation capability. Instead of generating one audio file per line, I group dialogue sections and send them as a single transcript with speaker tags (e.g., "Narrator: Once upon a time…", "Fox: Hello there!"). The API then generates a single, seamless audio file with the correct voices performing their parts, creating a natural-sounding dialogue.

Multimodal Features

The applet’s primary multimodal functionality lies in its sophisticated use of Text-to-Audio and Text-to-Structured-Data.

  • Text-to-Structured-Data (JSON Schema): The generation of a valid, structured JSON script from a text prompt is a key multimodal capability. It transforms a creative request into a machine-readable blueprint. This enhances the user experience by making the generation process reliable and robust. The AI’s ability to reason about the prompt and fit its creative output into a strict schema is what makes the subsequent automated steps (like casting and audio generation) possible.

  • Text-to-Audio (Multi-Speaker TTS): The conversion of the final script into a full-cast audio performance is the most prominent multimodal feature. The user experience is massively enhanced because they don’t just receive a script; they receive a finished product. The specific use of the multi-speaker functionality is critical. It allows the app to create believable interactions and dialogues between characters without the complex and error-prone process of generating hundreds of individual audio snippets and stitching them together. This feature directly translates the structured text script into a rich, layered audio experience, bringing the AI-generated story to life.

HI-FI News

via DEV Community https://dev.to

September 11, 2025 at 03:18AM