Dogfennaeth API lleferydd
Speech API Documentation
Fersiwn: Version: 2022.3
Wedi Diweddaru: Last Updated: 11th MawMar, 2022
Dechrau Arni Getting started
Mae'r API yn gweithio dros HTTPS GET, felly gellir defnyddio unrhyw iaith/meddalwedd HTTP er mwyn cysylltu at yr API.
The API works using HTTPS GET, meaning you can use it with any programming language/software package of your choice which works over HTTP
I ddefnyddio'r API yma, mi fyddwch angen allwedd API. Ewch i api.techiaith.org i gofrestru am eich tocyn.
To use this API, you need an API key. Please visit \ api.techiaith.org to get your own API key.
Nôl Llais Get Voice
I nôl llais mae angen i chi wneud galwad POST i'r url canlynol :
http://api.techiaith.org/coqui-tts/api/v1
To get voice you need to make a POST call to the following url :
http://api.techiaith.org/coqui-tts/api/v1
Sgema
Schema
Mae cysylltiad â'r API yn gweithio dros HTTPS yn unig, gan ddefnyddio'r parth `api.techiaith.org/MaryTTS`. Mae'r API yn anfon ffeiliau wav yn unig, mewn ffrwd sain.
The connection to the API is over HTTPS only, from the domain `api.techiaith.org/marytts`. The API sends wav files as audio streams to the receiver.
Paramedrau
QUERY PARAMETERS
Paramedr | Math | Disgrifiad | |
---|---|---|---|
Field | Type | Description | |
allwedd_api | String | Eich tocyn API. | Your API key. |
text | String | Y testun i'w lleferu. | The text to be spoken. |
speaker | String |
Allwedd i'r llais synthetig i'w ddefnyddio (Rhagor yn dod!). bd: benyw ddeheuol |
The speaker to use (More voices coming soon!). bd: southern female |
curl \
-X POST https://api.techiaith.org/coqui-tts/api/v1 \
-F 'api_key=allwedd_api_key' \
-F 'testun="Helo byd!"' \
-F 'siaradwr="bd"' > helo_byd.wav
Cyfyngu nifer yr alwadau yr awr Rate Limiting
Mae gan yr API gyfyngiad ar y nifer o alwadau y gellir eu gwneud mewn awr.
Mae'r cyfyngiad yn un hael iawn, ac rydym yn ystyried y bydd hyn yn ddigon ar gyfer y rhan fwyaf o'n defnyddwyr. Os ydych eisiau cynyddu nifer y galwadau at yr API sydd gennych, cysylltwch â ni.
Mae'r penynnau yn cynnwys yr holl wybodaeth sydd ei hangen:
Gellir gweld cyfanswm nifer eich galwadau ar unrhyw adeg drwy edrych ar 'HTTP headers' yn eich galwad API:
The API has a limit on the number of requests you can make per hour, linked to your API key.
You are initially given a high number of requests per hour, which we believe will be enough for most of our users. If you would like to increase the number of requests you can make to the API per hour, use the form within the 'API Centre'.
The headers contain all information you may require:
You can view the number of requests you have made/have remaining at any time by looking at the 'HTTP headers' of any response to the API:
Enw'r Penynnau | Disgrifiad |
---|---|
Header Name | Description |
X-RateLimit-Limit | Y nifer mwyaf o alwadau allwch chi eu gwneud mewn awr Maximum number of requests you can make per hour (rate limit) |
X-RateLimit-Remaining | Y nifer o alwadau sydd gennych ar ôl yn y 'blwch' cyfyngu presennol The number of requests remaining in the current rate limit window |
X-RateLimit-Reset | Yr amser y bydd y 'blwch' cyfyngu presennol yn cael ei ail-osod, mewn eiliadau epoch UTC The time at which the current rate limit window resets in UTC epoch seconds |
curl -i \
-X POST https://api.techiaith.org/coqui-tts/api/v1 \
-F 'api_key=allwedd_api_key' \
-F 'testun="Helo byd!"' \
-F 'siaradwr="bd"'
HTTP/1.1 200 OK
Date: Wed, 09 Mar 2022 23:47:21 GMT
Content-Type: audio/wav
Content-Length: 150092
Connection: keep-alive
X-Ratelimit-Limit: 300
X-Ratelimit-Remaining: 295
X-Ratelimit-Reset: 1646869861
Dweud yr amser Telling the time
Os oes arnoch angen yr amser mewn fformat gwahanol, gellir gwneud hyn gydag unrhyw iaith raglennu fodern. Er enghraifft, gellir gwneud hyn trwy gonsol eich porwr (gyda Javascript) a dychwelyd gwrthrych 'Javascript Date'.
If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object.
// javascript
new Date(1416237399 * 1000)
Date 2014-11-17T15:16:39.000Z
Mynd dros y terfyn Going over the limit
Ar ôl i chi fynd dros eich nifer mwyaf o alwadau yr awr, byddwch yn derbyn gwall gan y gweinydd (403 Forbidden):
Once you go over the rate limit you will receive an error response:
curl -i \
-X POST https://api.techiaith.org/coqui-tts/api/v1 \
-F 'api_key=allwedd_api_key' \
-F 'testun="Helo byd!"' \
-F 'siaradwr="bd"'
HTTP/1.1 403 Forbidden
Date: Wed, 09 Mar 2022 23:47:22 GMT
Content-Type: text/html
Content-Length: 257
Connection: keep-alive
X-RATELIMIT-REMAINING: 0
X-RATELIMIT-LIMIT: 300
X-RATELIMIT-RESET: 1418836717
ERROR 403 Forbidden: You have exceeded your request limit