Skip to main content

Synthesis via API

Aimyvoice provides an HTTP API for speech synthesis using voices from the catalog. You can use voices in third-party applications, for example, integrate them into voice assistants.

Request

Address

  • POST https://aimyvoice.com/api/v1/synthesize

Headers

  • Content-Type — application/x-www-form-urlencoded.

  • api-key — voice access token.

    tip
    To get a token, select the desired voice in the catalog and click Connect via API.

Body

In the request body, pass the parameter text: the text in English that you want to voiceover.

Text requirements:

  • Your text must be in English.
  • Length limit: 1 to 250 characters excluding markup.
  • Allowed special characters: € £ ₽ $ % № # & - — – + * = . , ! ? ; : " ` ' ° \ / ( ) < > « » ± ^.

Examples

caution
When sending a request, the text must be URL encoded (via percent-encoding).
import requests

# Forming the request
url = "https://aimyvoice.com/api/v1/synthesize"
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"api-key": "<api-key>"
}
payload = {
"text": requests.utils.quote('It’s Friday today, which means the long-awaited weekend is ahead!')
}

# Sending the request
response = requests.post(url, headers=headers, data=payload)

# Saving the response to an audio file
if response.status_code == 200:
with open("result.wav", "wb") as result:
result.write(response.content)

Reply

If the synthesis was successful, the response will be a binary data string. Save the string contents to a file with the .wav extension.

HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 19 Nov 2022 12:35:54 GMT
Content-Type: audio/wav
...

(Binary data string)