> For the complete documentation index, see [llms.txt](https://docs.ramsdenj.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ramsdenj.com/introduction-1/introduction-2/text_to_speech.md).

# Convert Text to Speech

To convert a plain text file to an mp3, use the [espeak](http://espeak.sourceforge.net/) speech synthesizer and [ffmpeg](https://www.ffmpeg.org/) to save the audio as an mp3.

```shell
espeak -f Book.txt --stdout | ffmpeg -i - -ab 192k -y AudioBook.mp3
```

To convert a pdf to an mp3, use [pdftotext](http://www.foolabs.com/xpdf/home.html).

```shell
pdftotext Book.pdf - | espeak --stdout | ffmpeg -i - -ab 192k -y AudioBook.mp3
```
