Text to speech

GRATIS CON POSSIBILITÀ DI UPGRADE
Da kelvin | Aggiornamento לפני חודש | Tools
Popolarità

9.5 / 10

Latenza

256ms

Livello di servizio

100%

Health Check

N/A

Torna a tutte le discussioni

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>

Partecipa alla discussione - aggiungi un commento di seguito:

Accedi/Iscriviti per pubblicare nuovi commenti