Giter Site home page Giter Site logo

HELP NEEDED about web-speech-demo HOT 2 CLOSED

hashkazi00 avatar hashkazi00 commented on September 21, 2024
HELP NEEDED

from web-speech-demo.

Comments (2)

hashkazi00 avatar hashkazi00 commented on September 21, 2024 1

the above issue was resolved by doing this:

var synthesis = undefined;
var voice = undefined;

window.onload = function () {
var voiceElement = document.getElementById("myBtn");
// voiceElement.speak();
};

if ("speechSynthesis" in window) {
synthesis = window.speechSynthesis;
console.log("1");
// Regex to match all English language tags e.g en, en-US, en-GB
var langRegex = /^en(-[a-z]{2})?$/i;
console.log("2");
setTimeout(function () {
// Get the available voices and filter the list to only have English speakers
voice = synthesis.getVoices().filter(function (voice) {
return voice.uri === "Rishi";
})[0];

speakWord("welcome to digi vision");

// var voices = synthesis
//   .getVoices()
//   .filter((voice) => langRegex.test(voice.lang));

// Log the properties of the voices in the list
// voices.forEach(function (voice) {
//   console.log({
//     name: voice.name,
//     lang: voice.lang,
//     uri: voice.voiceURI,
//     local: voice.localService,
//     default: voice.default,
//   });
// });

}, 300);
console.log("3");
} else {
console.log("Text-to-speech not supported.");
}

function speakWord(text) {
var utterance = new SpeechSynthesisUtterance(text);

// Set utterance properties
utterance.voice = voice;
utterance.pitch = 1.6;
utterance.rate = 1;
utterance.volume = 1.6;
console.log("4");
// Speak the utterance
synthesis.speak(utterance);
}

from web-speech-demo.

gladchinda avatar gladchinda commented on September 21, 2024

Can you share a sample of what your code looks like.

from web-speech-demo.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.