-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simple javascript funciton integration #340
Comments
Hi, we are using it and it works like charm, here is an example, which makes use of easy-speach and responsive voice: https://github.com/LiaScript/LiaScript/blob/development/src/typescript/liascript/service/TTS.ts |
Thank you so much for responding fast. But i visited the link you sent and copied the content, but please when i download the entire package, i really appreciate ur help |
Hi @kressly If you downloaded the package as zip, then take a look into the A minimal example could look like this: <html>
<head>
<script src="dist/EasySpeech.iife.js"></script>
</head>
<body>
<button onclick="EasySpeech.speak({ text: 'hello'})">Speak</button>
<script>EasySpeech.init()</script>
</body>
</html> From here you can further improve the code to your needs. Edit: if your application is entirely offline then please test before in offline mode, because some voices are only loaded by the browser afterwards and when an internet connection is available, this varies by browser and operating system though. |
thank you so much for your help, i actually copied the code u sent and added the script insertion yet when i click on speak, it says noting. in the console log i see Uncaught (in promise) SpeechSynthesisErrorEventisTrusted: truebubbles: falsecancelBubble: falsecancelable: falsecharIndex: 0charLength: 0composed: falsecurrentTarget: SpeechSynthesisUtterance {voiceURI: 'Microsoft David - English (United States)', text: 'hello', lang: 'en-US', voice: SpeechSynthesisVoice, volume: 1, …}defaultPrevented: falseelapsedTime: 8.899999618530273error: "synthesis-failed"eventPhase: 0name: ""returnValue: truesrcElement: SpeechSynthesisUtterance {voiceURI: 'Microsoft David - English (United States)', text: 'hello', lang: 'en-US', voice: SpeechSynthesisVoice, volume: 1, …}target: SpeechSynthesisUtterance {voiceURI: 'Microsoft David - English (United States)', text: 'hello', lang: 'en-US', voice: SpeechSynthesisVoice, volume: 1, …}timeStamp: 2057type: "error"utterance: SpeechSynthesisUtterance {voiceURI: 'Microsoft David - English (United States)', text: 'hello', lang: 'en-US', voice: SpeechSynthesisVoice, volume: 1, …}[[Prototype]]: SpeechSynthesisErrorEvent and here is what the code i used looks like <script src="js/easy-speech-master/dist/EasySpeech.iife.js"></script> Speak <script>EasySpeech.init()</script>however when i open the demo that is in the downloaded file, it works but i need someting that wil work as a function |
|
Hi
I tried the demo which worked but it seems almost impossible to create a simple javascript function so that i can use this awesome script outside of the demo, no matter how i tried it failed. I do not use npm and for days i tried to crate a function like speak_now(text_to_speak) and even though i copied what i saw in the demo, once outside the demo it did not work. Can u please show how to use this by doing a simple javascript integration without using npm ?
The text was updated successfully, but these errors were encountered: