I used espeak to speak some text in plain text files. However, some words in the file are emphasized using asterisks ("did you mean the *green* beans?"), and espeak will read them out literally ("did you mean the asterisk green asterisk beans?").

What should I replace the asterisks with, in order to have espeak read them emphasized correctly?

1 Answer 1


Espeak supports Speech Synthesis Markup Language (SSML), and you can just put those tags in the middle of a plain text file (i.e. you do not need to convert the whole thing to proper SSML). The tag you are looking for is probably <emphasis level="...">. Other possible tags are listed here: http://espeak.sourceforge.net/ssml.html

Espeak will not use them by default, you will need to pass the -mflag. For example, you could use espeak -m -f your_file.txt

The documentation is rather terse, so you might have to dive into source code in order to find things like possible values. (I would write better documentation, but there are nine year old unmerged patches and the source repository is unavailable, so it seems the project is completely dead.) The possible values for the emphasis tag (and some other tags) can be found here on Github. They are:

  • none
  • reduced
  • moderate
  • strong
  • x-strong

For example: Did you mean the <emphasis level="strong">green</emphasis> beans? Note that it will not work without quotes (whereas <emphasis level=strong> would work in HTML, it does not work without quotes in SSML/espeak).

Alternatively, espeak can read words in full caps differently by using the -k flag: if you use the command espeak -k20 -f your_file.txt, you'll notice that it changes the pitch for words in "FULL CAPS". The two options do not mix, so you cannot have emphasis and a pitch change by using both options.

In SSML, however, you can mix them: Did you mean the <emphasis level="strong"><prosody pitch="75">green</prosody></emphasis> beans? will be read with both emphasis and a higher pitch.

  • 1
    Is there a reason you aren't using the fork called eSpeakNG? Looks pretty active compared to its parent. (I'm just curious.)
    – B Layer
    May 5, 2018 at 21:47
  • 1
    @BLayer I was not aware of it, but found it later and have actually submitted a pull request: github.com/espeak-ng/espeak-ng/pull/482/files -- thanks for the tip though!
    – Luc
    May 5, 2018 at 21:55
  • No problem. Glad your doc improvement has found a good home.
    – B Layer
    May 5, 2018 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.