Jurček API v1
#
IntroductionThis guide describes steps that are required to use Jurček, a Text-To-Speech service specialized for Slovenian language, via API.
#
StepsFirstly, API user needs to exchange his credentials for a JWT access token, which is required for authentication in the following requests.
After successful retrieval of access token, user can perform the API request for transforming text to speech.
Generated speech is available as *.wav
audio file(s), which can be downloaded by another request.
Please contact us to obtain credentials (username & password) for testing purposes.
#
Retrieving JWT access tokenTo retrieve a JWT access token, an API user may send POST request to https://tts.true-bar.si/api/v1.0/auth with the following JSON in the body:
{ "username": "yourUsername", "password": "yourPasssword"}
If the request was successful, the access token is available inside access_token
field in the response's body:
{ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "validity": 60}
info
Please note that access token expires after 60 mins.
Example
curl --location --request POST 'https://tts.true-bar.si/api/v1.0/auth' \--header 'Content-Type: application/json' \--data-raw '{ "username": "yourUsername", "password": "yourPasssword"}'
#
SynthesisTo perform text to speech transformation, an API user may send POST request to https://tts.true-bar.si/api/v1.0/tts/si?jwt=access_token
, where access_token
is an access token retrieved in the previous step.
Text needs to be provided inside request's body as JSON object:
{ "text": "Dober dan. Zunaj sije sonce."}
info
The provided text is automatically preprocessed with accents, which helps to get better results during synthesis.
Generated audio files are split by sentences.
The response includes array of audio files' names, preprocessed text and belonging indexes:
{ "tts": [ { "audio": "1627661855.8768256.wav", "idx": 1, "text": "dóber dán." }, { "audio": "1627661856.0737078.wav", "idx": 2, "text": "zúnaj síje sónce." } ]}
Example
curl --location --request POST 'https://tts.true-bar.si/api/v1.0/tts/si?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...' \--header 'Content-Type: application/json' \--data-raw '{ "text": "Dober dan. Zunaj sije sonce."}'
#
Obtaining audio filesTo obtain specific audio file, an API user may send GET request to https://tts.true-bar.si/api/v1.0/audio/audioFileName
?jwt=access_token
.
Response is the requested *.wav
audio file.
Example
curl --location --output test.wav --request GET 'https://tts.true-bar.si/api/v1.0/audio/1627647189.9130378.wav?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...'