Vibe Coder · Unit 14: AI Video Production · Lesson 9 of 13

Voice from code

Generate narration from a script file with a few lines of code, so a change to the words is a re-run, not a re-record.

Read the short notes and pictures.Do everything inside a blue frame.

Narration as a build step

Once you have made one video by hand, the repeatable parts are worth automating. Keeping the script in a file and generating audio from it with an API call means every revision is one command, and timings can be read from the result.

A 3D scene of coloured blocks and cards. An API: your script, voice API, audio files.
A script goes through a voice API to audio files.

What to ask Claude Code for

  1. A script file

    One entry per line of narration.

  2. A small program

    That sends each line to the voice API and saves the audio.

  3. The key in the environment

    As always.

  4. A timing file

    The start and end of each line, for the edit.

A 3D scene of coloured blocks and cards. Script as data: hook: "Sending invoices is slow.", fi  "Tally sends one in a minute.".
The script is kept as data, one line at a time.

Why it helps

Fast revisions

Change text, re-run.

Consistency

Same voice and settings every time.

Captions for free

The script and timings become subtitles.

ActivityBuild · step 9 of 13A launch video

Automate your voice-over

Have Claude Code write a small program that generates your voice-over from a script file and writes a timing file. Change one line and regenerate.

Done when

Use the timing file to make captions in the edit.

Keep these

  • Voice models have APIs.
  • Keep the script as a file.
  • Regenerate instead of re-recording.