Text to speech

FREEMIUM
Por kelvin | Atualizado 한 달 전 | Tools
Popularidade

9.5 / 10

Latência

251ms

Nível de serviço

100%

Health Check

N/A

Voltar para todas as discussões

how to use audio sound

Rapid account: Rosly Dev
RoslyDev
일 년 전

hello I have all the problems in the world with your api, I obviously can’t use the answer
and in addition there is no documentation on how to do this, can you help me?

Rapid account: Rosly Dev
RoslyDev Commented 일 년 전

Thank’s i solve the problem

Rapid account: Kelvin 2 Go
kelvin2go Commented 일 년 전

whats language of BE do you use? i can give a example for that

Rapid account: Rosly Dev
RoslyDev Commented 일 년 전

I see, already thank you very much for your quick response but unfortunately I still have some concerns (PS js is not my cup of tea yet because I do more backend)

Basically I converted the blob to mpeg audio in my code but I couldn’t play the sound.

now i am more enlightened but i don’t know where to place the fast api option array?

const options = {
method: ‘GET’,
url: ‘https://text-to-speech27.p.rapidapi.com/speech’,
params: {
text: text,
lang: ‘fr’
},
headers: {
‘X-RapidAPI-Key’: ‘’,
‘X-RapidAPI-Host’: '
}
};

I have to put them in the StreamUrl? or https://text-to-speech27.p.rapidpi.com/speech?

Rapid account: Kelvin 2 Go
kelvin2go Commented 일 년 전

hi there,
like a html you can play the audio with call api like below

<audio id="audioPlayer" controls></audio>

<script>
  const audioPlayer = document.getElementById('audioPlayer');
  const streamUrl = 'your-api-endpoint-url';

  fetch(streamUrl)
    .then(response => response.blob())
    .then(blob => {
      const mediaSource = new MediaSource();
      audioPlayer.src = URL.createObjectURL(mediaSource);

      mediaSource.addEventListener('sourceopen', () => {
        const sourceBuffer = mediaSource.addSourceBuffer('audio/mpeg');
        sourceBuffer.addEventListener('updateend', () => {
          mediaSource.endOfStream();
          audioPlayer.play();
        });
        sourceBuffer.appendBuffer(blob);
      });
    });
</script>

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários