Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda