Sending text for conversion

To read the text aloud, send a POST request to the https://api.aspose.cloud/v5.0/ocr/converttexttospeech Aspose.OCR Cloud REST API endpoint. To authorize the request, pass the access token in Authorization header (Bearer authentication).

The text and conversion parameters are provided in JSON format in the request body.

{
	"text": "Read this text aloud",
	"settings": {
		"language": "English",
		"resultType": "Wav"
	}
}

Evaluation mode

To use Aspose.OCR Cloud TTS conversion in evaluation mode, send a POST request to the endpoint https://api.aspose.cloud/v5.0/ocr/ConvertTextToSpeechTrial.

This endpoint does not use the Authorization header, so there is no need to generate an access token. All settings remain the same as in regular text TTS requests.

Providing a text

The string to be read aloud is specified in the value of the text property.

Conversion settings

Property Type Default value Description
language string English Specify the language for reading the text aloud. At the moment, English is the only supported option.
resultType string Wav Audio file format. At the moment, Wav (Waveform Audio) is the only supported option.

Return value

If successful, this method returns a string with a unique identifier (GUID) of the text-to-speech conversion request in the queue.

Otherwise, it returns a HTTP status code corresponding to the error.

What’s next

The text-to-speech conversion will take a few seconds, depending on the amount of text and the current Aspose.Cloud load. See the article Fetching audio for information on how to fetch a voice from a server.

cURL example