Comment utiliser text to spech hors connexion en javascript
Frijo_7715
-
jordane45 Messages postés 40050 Statut Modérateur -
jordane45 Messages postés 40050 Statut Modérateur -
bonjour, comme le titre le dit, j'aimerai travailler avec la reconnaissance vocal et la synthèse vocal dans mon projet, et je souhaite que ça déroule en local. je veux savoir si y a une manière de le télécharger et l'inclure dans mon projet comme on inclus la bibliothèque JQuery. Merci d'avance pour votre aide.
A voir également:
- Comment utiliser text to spech hors connexion en javascript
- Gmail connexion - Guide
- Comment utiliser chromecast sur tv - Guide
- Spotify hors connexion - Guide
- Google maps hors connexion - Guide
- Gps hors connexion - Guide
1 réponse
Bonjour,
Pas de souci pour le faire fonctionner sans connexion internet, c'est inclus dans la bibliothèque de ton navigateur.
Par exemple :
<button onclick="go()" >GO</button>
<script>
function getVoices() {
let voices = speechSynthesis.getVoices();
if(!voices.length){
let utterance = new SpeechSynthesisUtterance("");
speechSynthesis.speak(utterance);
voices = speechSynthesis.getVoices();
}
return voices;
}
function go(){
if ('speechSynthesis' in window) {
let speakData = new SpeechSynthesisUtterance();
speakData.volume = 1; // From 0 to 1
speakData.rate = 1; // From 0.1 to 10
speakData.pitch = 2; // From 0 to 2
speakData.text = "ça marche sans connexion internet..";
speakData.lang = 'fr';
speakData.voice = getVoices()[0];
speechSynthesis.speak(speakData);
}else{
// Speech Synthesis is not Supported
console.log('ERROR');
}
}
</script>