Add text to speech to your website
Give your readers a Listen to this article button. It reads the article aloud right on your page, with no app or plugin for them to install.
How it works
- Create a free account and add your website's domain.
- Copy the two lines of code it gives you into your article template, where you want the button.
- Readers press the button and hear the article. The first listen of each article creates the audio; everyone after that gets it instantly.
The code
<div data-ttsmp3-player></div>
<script src="https://www.ttsmp3.ca/assets/embed.js"
data-key="YOUR_PLAYER_KEY"
data-lang="english"
data-target="article" async></script>
Options
| Attribute | What it does |
|---|---|
data-key | Your player key, from your account page. Required. |
data-lang | The article's language, for example english, french or arabic. The slug is the last part of each language page's address. |
data-target | A CSS selector for the article text. Defaults to article. Use something like .post-body if your theme is different. |
data-voice | Optional. A voice id from /api/voices?lang=english. |
data-label | Optional. Button text, such as "Écouter l'article". |
To skip parts of the page (captions, ads, "related posts"), add data-ttsmp3-skip to those elements.
WordPress
Paste the code into a Custom HTML block at the top of your post template, or into your theme's single.php just above the content.
Usage
Each account includes a monthly number of characters for the player. Only the first listen of an article counts. See pricing.