DEV Community

Cover image for Making your CV talk 🤖 How to send audio stream from Express JS?
Nikola Mitic
Nikola Mitic

Posted on

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

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay