tts · edtech · courses · voiceover · api
How to voice a lecture course with a TTS API: a practical guide for EdTech
Turn a lecture course into audio through an API: text preparation, voice choice, long lectures, mass generation, mastering and a budget you can plan.
Voicing a lecture course looks like a simple job until you start: a hundred lessons, each with terms, formulas, abbreviations and lists, and the output has to be a tidy audio library that survives content updates - not "a pile of files that came out somehow". A studio narrator solves that with money and calendar weeks; a TTS API solves it in an evening, but only if you treat it as an engineering task rather than a "make it sound nice" button.
This guide is the full route for an EdTech team: from text cleanup to mastering and cost estimates. Code is Python and TypeScript, the numbers come from our real plans, so you can size your own course without running a pilot first.
Why voice a course at all
There are usually three reasons, and they rarely come alone.
Accessibility. An audio version is not just convenience, it is a requirement: some students listen on the commute, some are visually impaired, some study in conditions where reading a screen is awkward. A course you can listen to reaches more people for the same amount of content.
Content multiplication. The same text lives in three formats: the lesson page, a podcast episode and a slide voiceover. Rewriting a course for audio costs money; voicing text that already exists costs almost nothing.
Faster updates. A living course changes: wording fixes, new sections, corrected mistakes. A narrator for each fix means a new studio session and matching it to the previous takes. TTS regenerates only the changed fragment and leaves the neighbouring files untouched.
What TTS does not give you: a lecturer's live intonation, jokes aside, and the "energy" that charismatic teachers are loved for. If a course rests on the author's personality, cloning their voice is a separate conversation, covered below. For methodological and reference modules, where precise wording matters more than delivery, automatic voiceover covers the task almost entirely.
Step 1. Text preparation: 80% of the audio quality is born here
The most common mistake is sending to synthesis what was typeset for a screen. Text read with the eyes and text read aloud are different texts.
Remove screen noise. Footnotes, captions like "Fig. 4", "see above", page numbers, bracketed links, editorial notes. All of it becomes garbage when spoken.
Split into paragraphs by meaning, not by column width. Synthesis reads a paragraph as one intonation unit: a 4000-character block without full stops gets an even, soporific reading. Paragraphs of 250-600 characters produce natural pauses and let you regenerate one piece without re-voicing the whole lesson.
Check numbers, dates and units. "2026" should read as "twenty twenty-six" in one context and "two thousand and twenty-six" in another. "5 °C", "3/4", "5-10%" - either rewrite them as words or listen and fix. The engine handles digits well, but context decides.
Expand abbreviations where pronunciation matters. Each of them can be read letter by letter, as a word, or something else entirely. If a course is full of domain abbreviations, use the pronunciation dictionary: the synthesis request accepts lexicon, an object of "word: how to read it", up to 200 pairs, whole-word and case-insensitive matching. The dictionary applies to plain text only: in SSML a substitution inside a tag would break the markup, so SSML requests ignore it.
Decide whether you need SSML. If a course has complex constructions with pauses, stress and tempo changes inside a sentence, set ssml: true and describe the markup with speak, p, s, break and prosody. Ninety percent of lectures do not need it: plain paragraphs plus speed are enough.
A practical rule: if the text is awkward to read aloud yourself, it is awkward to synthesize. Run one lesson through synthesis before you process a hundred.
Step 2. Voice choice: fewer options, more discipline
The service ships a library of presets, listed by GET /v1/voices. Every voice has an identifier, a language, tags and supported parameters - read the list from the API instead of hardcoding identifiers from documentation, so stale ids never end up in your code.
How to choose for a course:
- One voice for the whole course. A voice change mid-module reads as a narrator change and throws listeners off. If a course has several authors, assign each their own voice and never mix them inside one lesson.
- A calm neutral preset beats an "expressive" one. Teaching material needs intelligibility, not artistry: the fewer emotional spikes, the longer people can listen.
- Slightly slower than usual. For terminology-heavy lectures
speedaround 0.95 reads better than 1.0; for introductory overviews keep 1.0. Use the same tempo across the course. - Listen to five minutes, not one phrase. Short samples are almost always pleasant. Run a whole lesson and listen straight through - voice fatigue accumulates.
If the course must sound like its author, use cloning: one to three clean speech samples (wav, mp3, ogg, flac, m4a or aac up to 10 MB) together with the sample transcript, then synthesis with model: premium and voice: <clone id>. The reference is prepared automatically: cleaned, resampled to 24 kHz and trimmed to 8-15 seconds on sentence boundaries if needed. Availability by plan: Basic up to 5 voices, Pro up to 50, Business up to 500. Premium presets also require Pro or Business.
The legal part is mandatory and not negotiable: you may only clone a voice you have written permission to use. For a course that usually means an employment contract clause or a separate release.
Step 3. The first request: fifteen lines to test the hypothesis
Synthesis is a plain POST to /v1/synthesize, and the response is binary audio. Authorize with the key from the cabinet: the X-Api-Key header (Authorization: Bearer also works).
curl -X POST https://ttsapi.ru/v1/synthesize \
-H "Content-Type: application/json" \
-H "X-Api-Key: $TTS_API_KEY" \
-d '{"text":"Lesson one. Introduction to the subject.","voice":"preset_anna","format":"mp3","sample_rate":24000,"speed":0.95}' \
--output lesson-01-01.mp3
The same request in Python. Note that the SDK is a thin wrapper - even without it, httpx is enough.
import os
import httpx
API = "https://ttsapi.ru/v1"
HEADERS = {"X-Api-Key": os.environ["TTS_API_KEY"]}
def synthesize(text: str, voice: str = "preset_anna") -> bytes:
response = httpx.post(
f"{API}/synthesize",
headers=HEADERS,
json={
"text": text,
"voice": voice,
"format": "mp3",
"sample_rate": 24000,
"speed": 0.95,
},
timeout=120,
)
response.raise_for_status()
return response.content
audio = synthesize("Lesson one. Introduction to the subject.")
with open("lesson-01-01.mp3", "wb") as file:
file.write(audio)
The per-request limit is 5000 characters of text, roughly 700-800 words or 5-6 minutes of speech. Longer lectures need a strategy, and it is more than "cut and glue".
Step 4. Long lectures: three approaches, three different results
First: synchronous requests per paragraph. You split the text yourself, send 3000-5000 characters at a time, save the files and concatenate. Pros: full control, any fragment can be regenerated. Cons: you have no paragraph timings - you compute them yourself from file durations.
Second: asynchronous long-form synthesis. POST /v1/synthesize/async accepts a long text, queues it and immediately returns a job_id with an estimated duration. The service splits the text into paragraphs, synthesizes each and concatenates them into a single WAV with sample-accurate joins, returning paragraph timings in the manifest. Poll GET /v1/synthesize/async/{jobId} and download the result from GET /v1/synthesize/async/{jobId}/audio. You can pass webhookUrl and get notified instead of polling.
job = httpx.post(
f"{API}/synthesize/async",
headers=HEADERS,
json={"text": lecture_text, "voice": "preset_anna", "format": "wav", "speed": 0.95},
timeout=60,
).json()
# queue it and forget about it for a while
status = httpx.get(f"{API}/synthesize/async/{job['job_id']}", headers=HEADERS).json()
Those paragraph timings are what make this approach best for a course: slides, subtitles and the current-section highlight on the lesson page all synchronize from them. The price for the convenience is WAV: it is large and must be transcoded to mp3 or opus before delivery.
Third: the batch queue. POST /v1/batch/synthesize accepts up to 20 synthesis jobs at once and returns a batch_id; GET /v1/batch/{batchId} reports statuses and results per item, with the audio in base64. Handy when you need 20 short inserts voiced at once: definitions, examples, self-check questions.
The classic beginner mistake is sending a whole 40 000-character lecture in one request and hitting the limit. The second most common is cutting the text "every 5000 characters" without respecting sentence boundaries: a phrase sliced in half gets read with a pause in the middle of a word and betrays the whole automated process.
Step 5. Mass generation: voicing a hundred lessons without drowning
Once the single-lesson pilot works, the real job starts - the pipeline. Here is the minimum architecture, and it pays for itself on the second course.
A course manifest instead of a folder of files. Keep JSON or YAML describing every unit of voiceover: identifier, source text, text hash, voice parameters, file path.
{
"course": "algorithms-2026",
"voice": "preset_anna",
"speed": 0.95,
"units": [
{ "id": "01-01", "text_hash": "b1e4...", "text": "Lesson one. Introduction.", "format": "mp3" },
{ "id": "01-02", "text_hash": "9c02...", "text": "Definition of an algorithm.", "format": "mp3" }
]
}
Idempotency by text hash. Compute SHA-256 over the source text plus the synthesis parameters. If the hash matches an already generated file, skip it - spending neither quota nor time. One phrase changed means one phrase regenerated. This is the most valuable line in the whole pipeline: edits stop costing like a full re-voice.
Bounded parallelism. Synthesis is limited by the worker and the quotas, so 20 concurrent requests will not speed things up, they will only add errors. A sane start is 3-5 parallel tasks with exponential backoff on 429 and 5xx. Set generous timeouts: a minute per request is fine for a short fragment, but for long jobs use the asynchronous method rather than a long timeout.
Logs and reproducibility. Record exactly what you sent: text, voice, parameters, pipeline version. Six months later "why does this file sound different" is answered instantly with a log and not at all without one.
File naming. course/module/unit.format, where unit is a stable identifier from the manifest, not an array index. An index shifts as soon as a new paragraph is inserted in the middle.
Step 6. Mastering: the sound must be even across the course
Even perfect text sounds cheap when loudness jumps between lessons. Bring every file to one standard.
Loudness. The target for spoken content is around -16 LUFS integrated with true peak no higher than -1 dBTP. Do not aim at peak values: they do not reflect perceived loudness. One normalization pass over all files produces an effect listeners notice not as "louder" but as "more professional".
Noise and artefacts. Synthesis has almost none, but if you mix in music or splice with the author's own recordings, cleanup helps: POST /v1/audio/clean removes background noise and levels loudness. Effects - POST /v1/audio/effects - add EQ, compression, reverb, pitch and tempo changes. Useful scenarios for a course: a high_pass at 80 Hz to kill rumble, gentle compression for evenness, eq to shave harshness at 3-5 kHz. Go easy on reverb: in teaching material it reduces intelligibility.
Format and bitrate. For speech, mono mp3 at 48-64 kbps sounds no worse than stereo 128 kbps and halves the size. Opus at 32-48 kbps beats mp3 at the same size but needs player support. Keep WAV only as an intermediate format for concatenation and mastering.
Silence at the edges. Half a second of silence at the start and a second at the end is a small thing that makes transitions between lessons in a player feel normal.
Step 7. Storage and delivery: files are a product too
A voiced course quickly outgrows a filesystem. The math is simple: 60 lessons of 15 minutes in mp3 at 48 kbps is about 320 MB. That is no longer "put it on the app server's disk", especially once versions for different voices and editions appear.
Object storage instead of a local disk. Any S3-compatible store (configurable in the admin panel) gives you versioning, lifecycle rules and CDN delivery. The application server's local disk is a bad home for a media library: it does not scale and will not survive a migration.
Signed links. If the course is paid, files must not be reachable by a guessable URL. Short-lived signed links solve that without a separate authorization server.
Versioning instead of overwriting. A new take of a lesson must not break files a student already downloaded. Keep the version in the name or metadata and switch the pointer in the database.
Metadata inside the file. ID3 tags with the course, module and lesson number help offline listeners: the player shows something meaningful instead of lesson_final_v3.mp3.
What it costs: math on a real course
Take a typical online course: 60 lessons, an average lesson of 12 000 characters (roughly 13-15 minutes of speech). That is 720 000 characters per course.
| Plan | Characters per month | What it covers | Price per month |
|---|---|---|---|
| Free | 5 000 | One short fragment, a hypothesis check | 0 ₽ |
| Basic | 500 000 | 41 of 60 lessons | 390 ₽ |
| Pro | 2 000 000 | The whole course with room for regenerations | 1 490 ₽ |
| Business | 7 000 000 | Several courses in parallel, up to 500 cloned voices | 7 990 ₽ |
Beyond the included volume, synthesis costs 1.50 ₽ per 1000 characters and is charged to the balance - the service keeps working while there are funds. Counted purely as overage, the whole course would cost about 1 080 ₽. For comparison, an hour of studio recording with a narrator and editing costs an order of magnitude more, before revisions.
A real course budget is usually 20-40% above the minimum: the first text version always needs fixes after listening, and some fragments get regenerated. Plan the headroom up front.
Quality control: what to listen to and where it breaks
You will not listen to a hundred lessons by hand. Risk-based sampling works.
- Always listen to the first lesson in full. It sets the standard and reveals systemic problems: wrong tempo, wrong voice, mispronounced terms.
- Listen to fragments with numbers, Latin characters, abbreviations and formulas. That is where synthesis errs most.
- Check paragraph joins. If you split the text yourself, boundaries produce extra pauses or awkward splices.
- Watch the duration. Expected length is roughly the character count divided by 900: that gives seconds at about 15 characters per second. A 1.5x deviation means the text and reality diverged or the tempo slipped.
- Keep an acceptance checklist. "All files mp3 48 kbps mono, -16 LUFS, duration within 10% of the estimate, names match the manifest" - five points that save days of rework.
Legal and ethical boundaries
- Rights to the text. Voiceover creates no rights to text: voicing someone else's material needs the rights holder's permission.
- Rights to the voice. Cloning requires the narrator's consent, preferably written and stating where the voice will be used. Consent "for one course" does not cover advertising.
- Disclosure. Listeners have the right to know the voice is synthetic. One line in the course description settles it and does not hurt the experience.
- Personal data. Never send student personal data into synthesis: it is not needed for voiceover and creates extra obligations.
Launch checklist
- Run one lesson end to end and approve the voice, tempo and format.
- Describe the course manifest and the text-hash rule.
- Build a pronunciation dictionary for the course's terms and brands.
- Set up the pipeline: 3-5 parallel tasks, backoff retries, logging.
- Choose the long-lecture approach: asynchronous synthesis with timings where slide sync matters.
- Run mastering: loudness, format, silence at the edges.
- Upload to object storage, enable signed links and versioning.
- Do a risk-based acceptance pass.
- Fix the regeneration budget for the first term.
Takeaway
Voicing a course is not "press a button", it is a small pipeline: clean text, one approved voice, sensible splitting, hash-based caching, mastering and proper storage. Each step is simple on its own; together they turn synthesis from a demo trick into a production process that survives edits, updates and a growing course library.
Start small: one lesson, one voice, one listener who tells you whether it is comfortable to follow. The rest is engineering, and you already have it.
Ready to try it on your own material? Register and voice your first lesson for free - 5000 characters a month is enough for an introductory module and for making the call. Documentation and examples for Python, TypeScript, C#, Go, PHP and Java live in the docs, plans and limits are on the pricing page.
← Blog