Pitch Narration Generator
Parses a structured video script, extracts narrator blocks, and synthesises them into a single MP3 using Azure OpenAI TTS.
What this file does
Parses a structured video script, extracts narrator blocks, and synthesises them into a single MP3 using Azure OpenAI TTS.
When to use it
- You have a timed video script with narrator sections
- You want to generate a voiceover from a text script automatically
- You need per-section audio clips plus a final stitched narration
- You use Azure OpenAI TTS and want a repeatable pipeline
Assumes this stack
Pitch Narration Generator
Parses a structured video script, extracts all Narrator: blocks, and synthesises them into a single MP3 using Azure OpenAI TTS.
How it works
- Split the script on
Time: ...section headings - Extract each
Narrator:block - Synthesise each block via Azure OpenAI TTS →
output/section_NN.mp3 - Concatenate with a short pause between sections →
output/narration.mp3
Setup
1. Install dependencies
pip install openai python-dotenv pydub
pydubrequires ffmpeg for MP3 export:brew install ffmpeg # macOS
2. Configure credentials
cp .env.example .env
Fill in your Azure OpenAI TTS resource key and endpoint.
Usage
python video_gen.py script.txt
Your script file should use this format:
Time: 0:00-0:30 | Section Title
(Visual: optional stage direction — ignored)
Narrator: The text that will be spoken aloud.
Time: 0:30-1:00 | Next Section
Narrator: More narration here.
Output
output/
├── section_00.mp3 ← per-section audio clips
├── section_01.mp3
│ …
└── narration.mp3 ← final stitched narration
Configuration
| Setting | Where |
|---|---|
| TTS voice | voice= in synthesise() — options: alloy, echo, fable, nova, onyx, shimmer |
| TTS speed | speed= in synthesise() |
| Pause between sections | PAUSE_MS constant |
What's inside
1 setup section, 1 usage example, 1 output structure, 1 configuration table, 3 code blocks
Change this for your project
- Replace
voice=insynthesise()with your preferred TTS voice - Replace
speed=insynthesise()with your desired speech rate - Replace
PAUSE_MSconstant with your preferred pause duration
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
✍️ Content Creation Prompts
Provides 10 structured prompt templates for creating blog posts, social captions, email sequences, ad copy, video scripts, case studies, subject lines, repurposing plans, landing pages, and newsletters.
Demo Video Script - Kinetic Ledger
Provides a complete 10-scene video script for demoing a blockchain-based fitness fraud detection app, including voiceover, visuals, and post-production checklist.
Scriptwriting
Converts a research brief into a structured video script with timed segments, visual types, and narration rules for two specific formats.
Demo Video Script (30-60 Seconds)
Guides recording and editing a 30, 60 second product demo video with a timed script, screen prep, and post-production steps.