Il codice per generare e' il seguente (Il testo e' tratto dall'introduzione dalle Lecture on Physics di Feynman)
---------------------------------------------
<html>
<head>
<title>TTS</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var u1 = new SpeechSynthesisUtterance();
u1.text = $('div').html();
u1.lang = 'en-US';
u1.pitch = 2;
u1.rate = 0.5;
u1.voiceURI = 'native';
u1.volume = 0.5;
speechSynthesis.speak(u1);
});
</script>
<div id="demo_div">
This two-year course in physics is presented from the point of view that you, the reader, are going to be a physicist. This is not necessarily the case of course, but that is what every professor in every subject assumes! If you are going to be a physicist, you will have a lot to study: two hundred years of the most rapidly developing field of knowledge that there is. So much knowledge, in fact, that you might think that you cannot learn all of it in four years, and truly you cannot; you will have to go to graduate school too!
</div>
---------------------------------------------
e di seguito il video del risultato
Un'altra soluzione, costosa ma non poi cosi' tanto visti i risultati, e' data da GSpeech, un plugin per Joomla e Wordpress che surclassa decisamente le Api di TTS con un testo senza limiti di tempo e con una intonazione non piatta ma basata sulla punteggiatura (atttenzione audio basso)
Nessun commento:
Posta un commento