Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code not working #45

Open
didemkkaslan opened this issue Aug 5, 2024 · 2 comments
Open

Example code not working #45

didemkkaslan opened this issue Aug 5, 2024 · 2 comments

Comments

@didemkkaslan
Copy link

I'm trying to use the code inside text_to_speech_stream.ts to get audio stream and upload it on aws s3 but it gives me below error.


/**
 * Uses the ElevenLabs API to convert text to audio
 * @param text  The text to convert to audio
 * @returns The URL of the audio file
 */
export const textToSpeech: (text: string) => Promise<Buffer> = async (
  text: string
) => {
  return new Promise(async (resolve, reject) => {
    try {
      const audioStream = await elabs.generate({
        voice: "Rachel",
        model_id: "eleven_turbo_v2",
        text,
      });

      console.log("audioStream", audioStream);
      console.log(typeof audioStream);

      const chunks: Buffer[] = [];

      for await (const chunk of audioStream) {
        chunks.push(chunk);
      }

      const audio = Buffer.concat(chunks);

      resolve(audio);
    } catch (error) {
      console.log("error", error);
      reject(error);
    }
  });
};
Screenshot 2024-08-05 at 13 44 05
@usamatariq180
Copy link

Hi there, I want to ask that whether your app is capturing users voice from twilio and converting it to text or not?

@khcd
Copy link

khcd commented Oct 18, 2024

see #57 could be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants