Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Text to speach automatically calls Speak Function in react-speech-kit

I'm trying to create a speech-to-text command then the server will reply as text then convert it to speech using react-speech-kit. Both function works fine, but what I wanted to do is call the Speak() function from useSpeechSynthesis automatically.

I've called the speak function on onEnd function from useSpeechRecognition like this

  const onEnd = () => {
    fetch(
      "http://api/Main?id=test&lang=kor&req=" +
        value,
      {}
    )
      .then((res) => res.json())
      .then(
        (result) => {
          setResponse(result.res);
          speak(result.res);
          console.log(result);
        },
        (error) => {
          console.log(error);
        }
      );
    // You could do something here after speaking has finished
  };

But it doesn't speak for itself after the value has been passed.

Does anyone know how to make it automatic?

EDIT

I was wrong to call speak function like that, it should've be like this speak({text:result.res}); It is working now, TTS automatically calls, but it calls over and over again, not once, anyone knows how to fix it?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda