Making your CV talk 🤖 How to send audio stream from Express JS?

nmitic

Nikola Mitic

Posted on June 5, 2024

Making your CV talk 🤖 How to send audio stream from Express JS?

For our case this part was easy, as all we need to do is:

  1. Get buffered chunk
  2. Write to response object

And it looks like this.

    onChunkReceived: (chunk) => {
      const buffer = Buffer.from(chunk, "base64");
      res.write(buffer);
    },
Enter fullscreen mode Exit fullscreen mode

I will talk more about onChunkReceived method in the next section. Long story short, it it accepts a callback with chunk that come from web socket api. This is implementation details of how to work with Eleven Labs API.

Each time web socket sends an event that chunk is received it will write to response object and return chunk to the client.

This is the simplest way to combine express js with web socket api.


❤️If you would like to stay it touch please feel free to connect❤️

  1. X
  2. Linkedin
  3. nikola.mitic.dev@gmail.com

💖 💪 🙅 🚩
nmitic
Nikola Mitic

Posted on June 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related