You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/speech-service/rest-text-to-speech.md
+29-28Lines changed: 29 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,10 +41,10 @@ You can use the `tts.speech.microsoft.com/cognitiveservices/voices/list` endpoin
41
41
42
42
This table lists required and optional headers for text to speech requests:
43
43
44
-
| Header | Description | Required or optional |
45
-
|--------|-------------|---------------------|
46
-
|`Ocp-Apim-Subscription-Key`| Your Speech resource key. | Either this header or `Authorization` is required. |
47
-
|`Authorization`| An authorization token preceded by the word `Bearer`. For more information, see [Authentication](#authentication). | Either this header or `Ocp-Apim-Subscription-Key` is required. |
|`Ocp-Apim-Subscription-Key`| Your Speech resource key. | Either this header or `Authorization` is required.|
47
+
|`Authorization`| An authorization token preceded by the word `Bearer`. For more information, see [Authentication](#authentication). | Either this header or `Ocp-Apim-Subscription-Key` is required. |
48
48
49
49
### Request body
50
50
@@ -73,7 +73,7 @@ curl --location --request GET 'https://YOUR_RESOURCE_REGION.tts.speech.microsoft
73
73
You should receive a response with a JSON body that includes all supported locales, voices, gender, styles, and other details. The `WordsPerMinute` property for each voice can be used to estimate the length of the output speech. This JSON example shows partial results to illustrate the structure of a response:
74
74
75
75
```json
76
-
[
76
+
[
77
77
// Redacted for brevity
78
78
{
79
79
"Name": "Microsoft Server Speech Text to Speech Voice (en-US, JennyNeural)",
@@ -191,13 +191,13 @@ You should receive a response with a JSON body that includes all supported local
191
191
192
192
The HTTP status code for each response indicates success or common errors.
193
193
194
-
| HTTP status code | Description | Possible reason |
| 400 | Bad request | A required parameter is missing, empty, or null. Or, the value passed to either a required or optional parameter is invalid. A common reason is a header that's too long. |
198
-
| 401 | Unauthorized | The request isn't authorized. Make sure your resource key or token is valid and in the correct region. |
199
-
| 429 | Too many requests | You exceeded the quota or rate of requests allowed for your resource. |
200
-
| 502 | Bad gateway | There's a network or server-side problem. This status might also indicate invalid headers. |
194
+
| HTTP status code | Description | Possible reason|
| 400 | Bad request| A required parameter is missing, empty, or null. Or, the value passed to either a required or optional parameter is invalid. A common reason is a header that's too long. |
198
+
| 401 | Unauthorized | The request isn't authorized. Make sure your resource key or token is valid and in the correct region.|
199
+
| 429 | Too many requests | You exceeded the quota or rate of requests allowed for your resource.|
200
+
| 502 | Bad gateway | There's a network or server-side problem. This status might also indicate invalid headers.|
201
201
202
202
203
203
## Convert text to speech
@@ -214,12 +214,12 @@ These regions are supported for text to speech through the REST API. Be sure to
214
214
215
215
This table lists required and optional headers for text to speech requests:
216
216
217
-
| Header | Description | Required or optional |
218
-
|--------|-------------|---------------------|
219
-
|`Authorization`| An authorization token preceded by the word `Bearer`. For more information, see [Authentication](#authentication). | Required |
220
-
|`Content-Type`| Specifies the content type for the provided text. Accepted value: `application/ssml+xml`. | Required |
221
-
|`X-Microsoft-OutputFormat`| Specifies the audio output format. For a complete list of accepted values, see [Audio outputs](#audio-outputs). | Required |
222
-
|`User-Agent`| The application name. The provided value must be fewer than 255 characters. | Required |
|`Authorization`| An authorization token preceded by the word `Bearer`. For more information, see [Authentication](#authentication). | Required|
220
+
|`Content-Type`| Specifies the content type for the provided text. Accepted value: `application/ssml+xml`. | Required|
221
+
|`X-Microsoft-OutputFormat`| Specifies the audio output format. For a complete list of accepted values, see [Audio outputs](#audio-outputs). | Required|
222
+
|`User-Agent`| The application name. The provided value must be fewer than 255 characters. | Required|
| 200 | OK | The request was successful. The response body is an audio file. |
256
-
| 400 | Bad request | A required parameter is missing, empty, or null. Or, the value passed to either a required or optional parameter is invalid. A common reason is a header that's too long. |
257
-
| 401 | Unauthorized | The request isn't authorized. Make sure your Speech resource key or token is valid and in the correct region. |
258
-
| 415 | Unsupported media type | It's possible that the wrong `Content-Type` value was provided. `Content-Type` should be set to `application/ssml+xml`. |
259
-
| 429 | Too many requests | You exceeded the quota or rate of requests allowed for your resource. |
260
-
| 502 | Bad gateway | There's a network or server-side problem. This status might also indicate invalid headers. |
261
-
| 503 | Service Unavailable | There's a server-side problem for various reasons. |
253
+
| HTTP status code | Description | Possible reason|
| 200 | OK | The request was successful. The response body is an audio file.|
256
+
| 400 | Bad request| A required parameter is missing, empty, or null. Or, the value passed to either a required or optional parameter is invalid. A common reason is a header that's too long. |
257
+
| 401 | Unauthorized | The request isn't authorized. Make sure your Speech resource key or token is valid and in the correct region.|
258
+
| 415 | Unsupported media type | It's possible that the wrong `Content-Type` value was provided. `Content-Type` should be set to `application/ssml+xml`.|
259
+
| 429 | Too many requests | You exceeded the quota or rate of requests allowed for your resource.|
260
+
| 502 | Bad gateway | There's a network or server-side problem. This status might also indicate invalid headers.|
261
+
| 503 | Service Unavailable | There's a server-side problem for various reasons.|
262
262
263
263
If the HTTP status is `200 OK`, the body of the response contains an audio file in the requested format. This file can be played as it's transferred, saved to a buffer, or saved to a file.
264
264
265
265
## Audio outputs
266
266
267
-
The supported streaming and nonstreaming audio formats are sent in each request as the `X-Microsoft-OutputFormat` header. Each format incorporates a bit rate and encoding type. The Speech service supports 48-kHz, 24-kHz, 16-kHz, and 8-kHz audio outputs. Each prebuilt neural voice model is available at 24kHz and high-fidelity 48kHz.
267
+
The supported streaming and nonstreaming audio formats are sent in each request as the `X-Microsoft-OutputFormat` header. Each format incorporates a bit rate and encoding type. The Speech service supports 48-kHz, 24-kHz, 16-kHz, and 8-kHz audio outputs. Each prebuilt neural voice model is available at 24kHz and high-fidelity 48kHz.
0 commit comments