Narrating a long text
Turn an article or a book chapter into one audio file: split the text into 5,000-character parts, ask for raw PCM, and write a single WAV.
One request takes up to 5,000 characters. Split longer text at sentence boundaries and request each part with response_format: "pcm": headerless samples join end to end into one seamless file.
The script
The script reads makale.txt, packs sentences into parts of at most 5,000 characters, speaks each with the alania2-m1 voice and writes everything to makale.wav, with a 0.4-second pause between parts.
Running it
For a smaller file for the web or a podcast feed, convert the WAV to MP3 with ffmpeg. Alania can return mp3 directly too, but for one file joined from parts, PCM is cleaner.
Names and terms
If the text has foreign terms, add pronunciations to each request or save them once to your account's dictionary. Numbers, dates and amounts are already read as spoken.