Possible To Send Audio Files Through Websocket?
I am building a web application that generates a new audio file depending on the input from the user. The wav file is generated in our python backend and now I want to be able to p
Solution 1:
I don't see why you couldn't do this.
- encode your audio into MP3 or OGG or whatever your target browser(s) support
- send it over the web socket to the client
- receive the data into something blob-like
Then, depending on how you want to play things,
- generate an object URL out of the data and pass that in as the
src
for an<audio>
tag, or - use the Web Audio API and
decodeAudioData
to get a buffer source you can play.
Post a Comment for "Possible To Send Audio Files Through Websocket?"