Text to speech

부분 유료
분류별 kelvin | 업데이트됨 एक महीने पहले | Tools
인기

9.5 / 10

지연 시간

255ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

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>

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입