Sending/Receiving Audio Packets via Websockets #1743
-
Hello there, But currently i am running into a wall - so i figured i might open a discussion here: I started of with the sinewave and then microphone loopback to i2s amplifier examples, listening to url streams and hosting a microphone webserver so far and at last managed to setup a continious stream between two identical esp32 boards each equiped with an i2s inmp441 microphone and i2s max98357a amplifier and speaker using the ip sender/receiver examples ( that is after i figured out that i need to read 32bit from the microphone first and then transform it to 16 bit rather than trying to read 16bit directly as done by other audio examples online using the i2sdrive.h library) Currently one board is always acting as the sender and one as the receiver (the goal is to make a project with two way communication). Now i am trying to adapt these examples to use a central relay server and websocket communication, to be able to
The issue is that i can not figure out how i can correctly send the converted i2s stream from the microphone via websockets and push received binary data from the websocket messages toward the i2s output stream. I had a look on https://github.com/pschatzmann/arduino-audio-tools/wiki/Writing-your-Custom-Input&Output-Class but unfortunately cannot wrap my head around this. I also found that the websocket library seems to only beeing able to work with 8bit data packets, meaning that i need to split my 16bit i2s output packets into 8bit packets and then sticht them back together at the receiver side - but i can´t figure out how i get messages from the webSocketEvent WStype_BIN into the i2s output stream. I guess i need to use some Form of Buffer and maybe the QueueStream? to send the websocket packets to the i2s output stream - but thats where i get lost. Any ideas on this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I haven't done anything with websockets yet, but here are my 5 cents:
I suggest you read the Wikis about
Just a simpler alternative:
|
Beta Was this translation helpful? Give feedback.
-
I suggest that you have another look at this Wiki |
Beta Was this translation helpful? Give feedback.
I haven't done anything with websockets yet, but here are my 5 cents: