android-js / androidjs

Platform to build android app using node js
MIT License
465 stars 110 forks source link

Text to Speech API #239

Open tubbadu opened 2 years ago

tubbadu commented 2 years ago

Is your feature request related to a problem? Please describe. I'm building an app with androidjs, and I need the application to speak a text, and it should work offline

There are several online TTS API, but I need it to be working offline, so I need to use the default Android Text To Speech (settings > general settings > language and input > Text To Speech)

is there a way to do this? should this be implemented or is there a way already?

anthonym01 commented 2 years ago
async function speak(spookvalue) {
    console.log("gonna say: ", spookvalue)

    let synth = window.speechSynthesis;
    //synth.pause()

    let utterThis = new SpeechSynthesisUtterance(spookvalue);

    synth.speak(utterThis);
}

Close this issue