<script src="https://astica.ai/javascript-sdk/2023-07-09/astica.api.js"></script>
<script>
asticaAPI_start('API KEY HERE'); //only needs to be called once.
//Simple usage:
asticaVoice('Hi! How are you doing today?');
//Specify a voice id:
asticaVoice('Hi! How are you doing today?', 5);
//With custom callback:
asticaVoice('Hi! How are you doing today?', 5, your_astica_CallBack);
function your_astica_CallBack(data) {
if(typeof data.error != 'undefined') { alert(data.error); return; }
}
//With function and parameters:
function asticaVoice_example(string) {
asticaVoice(
'1.0_full'
string,
'en-US',
0,
your_astica_CallBack
);
}
setTimeout(function() {
asticaAPI_start('API KEY HERE'); //only needs to be called once.
asticaVoice_example('Hi! How are you doing?');
}, 1000);
</script>