Audio version — Estimated duration: 2 min 32 sec

Batch-process an entire directory of markdown files.

python tts_pipeline.py --dir ./path/to/docs

How it works

  1. Scan — Recursively walks the directory, skipping hidden dirs and voice-notes/
  2. Orderindex.md first, then pipeline/, then everything else alphabetically
  3. LLM rewrite — Sends each file to Cerebras or llama.cpp for conversational rewrite
  4. TTS synthesis — Generates audio via edge-tts or Piper
  5. Embed — Injects <audio> tag with duration into the source .md file
  6. Save — Writes voice-friendly markdown to voice-notes/ (mirrored tree)

File ordering

PriorityFolderNotes
1. (root)index.md is always first
2pipeline/Logical tutorial flow
3Everything elseAlphabetical

The index file gets a special prompt: ~200 words and a suggestion to continue reading the next file.

Rate limiting

Online LLM mode enforces 5 requests per 60 seconds (sliding window). The pipeline pauses automatically — you will see [RATE] messages.

Arguments

See CLI Reference for all flags.

python tts_pipeline.py --dir ./docs --llm local --tts online --voice en-GB-SoniaNeural