podcast-generation – Writing & Content skill for AI agents
Generate real audio narratives from text content using Azure OpenAI's Realtime API.
Install the podcast-generation skill with one command
Pick the tool you use, copy the command and paste it in your terminal. The skill lands in that tool's skills folder and is ready in your next session.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/podcast-generation-3fb0e.tgz | tar xz -C ~/.claude/skills
Call it in Claude Code: /podcast-generation – then describe the task you want done.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/podcast-generation-3fb0e.tgz | tar xz -C ~/.codex/skills
Call it in Codex: $podcast-generation – then describe the task you want done.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/podcast-generation-3fb0e.tgz | tar xz -C ~/.hermes/skills
Call it in Hermes Agent: /podcast-generation – then describe the task you want done.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/podcast-generation-3fb0e.tgz | tar xz -C ~/.deepcode/skills
Call it in DeepSeek: /podcast-generation – then describe the task you want done.
SKILL.md content
Bundled upstream support
Supporting files are included at skill-relative paths. See [UPSTREAM-NOTICE.md](UPSTREAM-NOTICE.md) for their pinned sources, licenses, hashes, and import changes.
Podcast Generation with GPT Realtime Mini
Generate real audio narratives from text content using Azure OpenAI's Realtime API.
Quick Start
1. Configure environment variables for Realtime API
2. Connect via WebSocket to Azure OpenAI Realtime endpoint
3. Send text prompt, collect PCM audio chunks + transcript
4. Convert PCM to WAV format
5. Return base64-encoded audio to frontend for playback
Environment Configuration
AZURE_OPENAI_AUDIO_API_KEY=your_realtime_api_key
AZURE_OPENAI_AUDIO_ENDPOINT=https://your-resource.cognitiveservices.azure.com
AZURE_OPENAI_AUDIO_DEPLOYMENT=gpt-realtime-miniNote: Endpoint should NOT include /openai/v1/ - just the base URL.
Core Workflow
Backend Audio Generation
from openai import AsyncOpenAI
import base64
# Convert HTTPS endpoint to WebSocket URL
ws_url = endpoint.rstrip("/").replace("https://", "wss://", 1) + "/openai/v1"
client = AsyncOpenAI(
websocket_base_url=ws_url,
api_key=api_key
)
audio_chunks = []
transcript_parts = []
async with client.realtime.connect(model=deployment_name) as conn:
# Configure for audio-only output
await conn.session.update(session={
"type": "realtime",
"audio": {"output": {"voice": voice_name, "format": {"type": "audio/pcm", "rate": 24000}}},
"output_modalities": ["audio"],
"instructions": "You are a narrator. Speak naturally."
})
# Send text to narrate
await conn.conversation.item.create(item={
"type": "message",
"role": "user",
"content": [{"type": "input_text", "text": prompt}]
})
await conn.response.create()
# Collect streaming events
async for event in conn:
if event.type == "response.output_audio.delta":
audio_chunks.append(base64.b64decode(event.delta))
elif event.type == "response.output_audio_transcript.delta":
transcript_parts.append(event.delta)
elif event.type == "error":
raise RuntimeError("Realtime service error; inspect redacted private diagnostics")
elif event.type == "response.done":
if event.response.status != "completed":
raise RuntimeError("Incomplete audio response")
break
# Convert PCM to WAV (see scripts/pcm_to_wav.py)
pcm_audio = b''.join(audio_chunks)
wav_audio = pcm_to_wav(pcm_audio, sample_rate=24000)Frontend Audio Playback
// Convert base64 WAV to playable blob
const base64ToBlob = (base64, mimeType) => {
const bytes = atob(base64);
const arr = new Uint8Array(bytes.length);
for (let i = 0; i < bytes.length; i++) arr[i] = bytes.charCodeAt(i);
return new Blob([arr], { type: mimeType });
};
const audioBlob = base64ToBlob(response.audio_data, 'audio/wav');
const audioUrl = URL.createObjectURL(audioBlob);
const player = new Audio(audioUrl);
player.onended = () => URL.revokeObjectURL(audioUrl);
player.onerror = () => URL.revokeObjectURL(audioUrl);
// Invoke from a user gesture and handle autoplay rejection/teardown.
player.play().catch(() => URL.revokeObjectURL(audioUrl));Historical voice examples (verify deployment support)
| Voice | Character |
|-------|-----------|
| alloy | Neutral |
| echo | Warm |
| fable | Expressive |
| onyx | Deep |
| nova | Friendly |
| shimmer | Clear |
Realtime API Events
response.output_audio.delta- Base64 audio chunkresponse.output_audio_transcript.delta- Transcript textresponse.done- Generation completeerror- Handle withevent.error.message
Audio Format
- Input: Text prompt
- Output: PCM audio (24kHz, 16-bit, mono)
- Storage: Base64-encoded WAV
References
- Full architecture: See references/architecture.md for complete stack design
- Code examples: See references/code-examples.md for integration sketches
- PCM conversion: Use scripts/pcm_to_wav.py for audio format conversion
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Generation boundaries
Unexecuted SDK/service sketches: deployment name, available voices, GA versus preview
session/auth format and SDK versions must match the actual Azure resource. The voice
table is not a current Realtime support list. Configure explicit PCM output before
interpreting bytes as 24kHz signed 16-bit mono; reject incomplete/empty output.
The examples omit a mandatory total generation timeout (e.g. 60 seconds), per-event
and accumulated audio/text limits (e.g. 32 MiB), cancel/close paths and spend quotas;
implement them before serving requests. A response.done event alone does not mean
success. Do not store partial output as a complete narrative.
Authorize source objects AND audio generation/list/stream ownership per tenant; IDs
are not access control. The DB methods/models/routes, settings and frontend API are
application adapters, not bundled implementations. Treat source text as data, preserve
source attribution, verify narration accuracy and obtain rights/consent before sending
private text to Azure or publishing synthetic speech. Never impersonate a real person
without permission; disclose generated speech where required. Store keys backend-only
and audio/transcripts privately with retention limits. Model-generated text is not
HTML. Frontend play/pause requires actual pause handling, promise errors, finally
loading reset, URL revocation and teardown; the React sketch omits those controls.
PCM helper usage: python3 <skill-dir>/scripts/pcm_to_wav.py input.pcm output.wav refuses overwrites and incomplete frames; it does not detect whether arbitrary bytes really are the declared PCM format.
Related skills
- post – Make share-post image sets that look native: Xiaohongshu carousels, X images, covers…
- postel-writing – Draft X (Twitter) or LinkedIn posts in the user's own voice, research high-performing…
- poster-design-studio – Install and use the official AI Poster Maker package, pinned by digest, for paid hosted…
- postgres-best-practices – Postgres performance optimization and best practices from Supabase. Use this skill when…
- postgres-readonly-queries – Execute safe read-only SQL queries against PostgreSQL databases with multi-connection…
- postgresql – Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing…
- postgresql-cli – PostgreSQL interactive terminal (psql) reference and usage guide.
- postgresql-devsec – Administer PostgreSQL databases. Configure replication, backups, and performance tuning…