Voice AI API Documentation
The asticaVoice API allows developers to integrate natural-sounding voice outputs into their applications.
Offering a wide selection of voices, seamless integration requiring a single line of code, and multilanguage support, asticaVoice API is an excellent choice for applications that demand high-quality speech output.
This documentation provides a detailed overview of the API's features, and a tutorial for generating realistic voice with javascript.
1. Real-time Speech Generation:
The asticaVoice API allows you to generate realistic speech suitable for time sensitive applications and real-time use.
All voices are synthesized on demand and just in time.
2. Diverse and Realistic Voices:
Browse a vast library of over 40+ unique voices to choose from, comprised of different age groups, genders, and nationalities.
This enables developers to tailor the voice output and personality to suit their specific needs and preferences of their users for a more personalized and engaging user experience.
3. Multilingual Support:
asticaVoice is capable of supporting multiple languages with a high level fluency.
The ability to handle translated text to speech is instrumental in supporting seamless experiences for global audiences and adapting content to cater to diverse linguistic demographics.
4. Simple Integration
Integrating asticaVoice API into your project requires only a single line of code, making it a straightforward and hassle-free process.
With minimal effort, you can enable your application or platform to offer high-quality text-to-speech functionality.
The asticaVoice API facilitates access to state of the art computer voice and text to speech engine and that offers a wide range of features to create high-quality, engaging voice outputs.
Try OnlineYou can submit request to generate speech using a CURL.
CURL Sample
The following CURL command can be pasted into a terminal to generate a response from the API. The result will contain audio data containing the generated speech.
curl --location --request POST 'https://voice.astica.ai/speak' \ --header 'Content-Type: application/json' \ --insecure \ --data '{ "tkn": "YOUR API KEY", "modelVersion": "1.0_full", "input": "hello, how are you doing today?", "voice": 0, "lang": "en-US" }'
Note that you need to replace "YOUR API KEY" with your actual API key.
The Voice API will return a buffer containing the audio data. This can be wrote to a local file for playback.
Integrating the Javascript Text to Speech API
You can copy and paste the working sample code found below. You can also following along for a step by step integration tutorial.
<script src="https://www.astica.org/endpoint/ml/javascript/2023-04-10/astica.api.js"></script> function asticaVoice_example(string) { asticaVoice( '1.0_full' string, 'en-US', 0, your_astica_CallBack ); } function your_astica_CallBack(data) { if(typeof data.error != 'undefined') { alert(data.error); } console.log(data); //view all data } setTimeout(function() { asticaAPI_start('API KEY HERE'); //only needs to be called once. asticaVoice_example('Hi! How are you doing?'); }, 1000);
Step #1:
Include the Javascript Library:
Start by including the astica API javascript library with the following script tag.
This should be added before the closing </head> tag of your website.
<script src="https://www.astica.org/endpoint/ml/javascript/2023-04-10/astica.api.js"></script>
Step #2:
Authenticate with the astica Javascript API:
Next, start the API by calling asticaAPI_start('API KEY HERE');
You only need to call this function once. Make sure to add a valid API key generated from your dashboard.
asticaAPI_start('API KEY HERE');
Step #3:
Generating Natural Voice with Javascript
You are now ready to use javascript text to speech with asticaVoice. You can use the simple version to quickly integrate and begin generating natural voice inside of your application..
asticaVoice('I love to hear myself talk!');
setTimeout(function() { asticaAPI_start('API KEY HERE'); asticaVoice('I love to hear myself talk!'); }, 2000);
Optional
asticaVoice ‐ Selecting a Voice
To specify a voice ID, add a number after the text to be spoken. The full list of voice ID is found in a list at the bottom of this documentation. Jump down to Voice List
asticaVoice('My name could be Dennis',4);
Optional
asticaVoice ‐ Custom Callback Parameters
You can use a custom callback to acknowledge the API response from asticaVision by specifying a function after the voice ID. This can be used to determine when the synthesized speech result has started to play, and can be used to track usage data.
asticaVoice_speak('Hi! How are you doing today?', 5, your_astica_CallBack); function your_astica_CallBack(data) { if(typeof data.error != 'undefined') { alert(data.error); return; } console.log(data); }
In this following example, we generate text to speech using voice id 5 and specify our own callback function that will generate an alert if an error is found.
Optional
asticaVoice ‐ Advanced Parameters
asticaVoice allows you to specify different model versions, and also a language code to use. Jump down to Voice List
asticaVoice( '1.0_full' 'My favorite color is blue', 'en-US', 0, your_astica_CallBack ); function your_astica_CallBack(data) { if(typeof data.error != 'undefined') { alert(data.error); return; } console.log(data); }
By specifying the correct language code for your input, you can receive more grammatically correct and fluent vocabulary and announciation.
The asticaVoice text to speech API offers many different voices to help you customize your application and create engaging experiences. You can choose from different speakers, genders, and dialects used to match your brand. Voices are sorted by region/dialect and are identified using a voice id.
USA (us-EN)
Voice ID | Voice Name |
---|---|
0 | Default Voice (US Female) |
1 | Jennifer (US Female) |
2 | Natalie (US Female) |
3 | Janet (US Female) |
5 | Jerome (US Male) |
6 | Chris (US Male) |
7 | Bryan (US Male) |
8 | Ron (US Male) |
9 | Steve (US Male) |
Children Voices
Voice ID | Voice Name |
---|---|
501 | Anna (US Female) (Child) |
502 | Maisy (UK Female) (Child) |
503 | Carla (AU Female) (Child) |
Austrailian Voices (au-EN)
Voice ID | Voice Name |
---|---|
10 | Derek (AU Male) |
11 | Kevin (AU Male) |
12 | Nathan (AU Male) |
13 | Timothy (AU Male) |
14 | Eleanor (AU Female) |
15 | Kylie (AU Female) |
16 | Natalia (AU Female) |
17 | Tina (AU Female) |
Great Britain / England Voices (en-GB)
Voice ID | Voice Name |
---|---|
18 | Olivia (UK Female) |
19 | Sophie (UK Female) |
20 | Isabella (UK Female) |
21 | Abigail (UK Female) |
22 | Alfred (UK Male) |
23 | Elijah (UK Male) |
24 | Evan (UK Male) |
25 | Oscar (UK Male) |
26 | Raymond (UK Male) |
27 | Tom (UK Male) |
French Voices (fr-FR)
Voice ID | Voice Name |
---|---|
2000 | Alain (Male) (French) |
2001 | Henry (Male) (French) |
2002 | Denise (Female) (French) |
2003 | Cora (Female) (French) |
French Canadian Voices(fr-CA)
Voice ID | Voice Name |
---|---|
3000 | John (Male) (French Canadian) |
3001 | Anthony (Male) (French Canadian) |
3002 | Sylvia (Female) (French Canadian) |
Indian Voices (en-IN)
Voice ID | Voice Name |
---|---|
4000 | Prakash (Indian Male) (English) |
4001 | Neha (Indian Female) (English) |
Nigerian Voices (en-NG)
Voice ID | Voice Name |
---|---|
5000 | Abel (Nigerian Male) (English) |
5001 | Ezinne (Nigerian Female) (English) |
Discover More AI
Experiment with different kinds of artificial intelligence. See, hear, and speak with astica.