I2S input -> Codec -> ESP Now #2254
-
OverviewI’m trying to evaluate low latency audio streaming using ESP32 NOW. I'd like to experiment with tweaking the codec choice and setting to achieve the lowest high quality stream over ESP NOW. Some progress has been made from the excellent library and examples, but I’m struggling with this particular pattern ESP32 A = EXTERNAL AUDIO SOURCE -> I2S OUT
A -> B -> C -> External DAC Eventually, the I2S IN will be supplied by another board , but for the sake of learning this library and how it handles the signals, I have bought another ESP32 S3, which simply runs the following HLS-> I2S example: here. So this code is running on ESP32 A I am using a PCM5102 DAC, detailed here. A few positive observations so farI have verified that the DAC is working by plugging directly into the ESP32 A. I hear clean stereo audio. I have also successfully run this example which encodes a generated sine tone into SBC on ESP32 B and sends it over ESP NOW. This broadcast is received on ESP32 C fine and plays through the DAC as expected. Excellent. Promising stuff. Issues receiving an I2S input streamHowever, I’m now trying to modify the example to instead take an I2S stream input from ESP32 A rather than the generated sine tone. I currently try to take the incoming i2s input, convert the format to 32khz, mono, 16bit and pass into ESP NOW just like the example above. I currently can just about make out the correct signal in the ESP32 C output to the DAC, but it is 99% noise. This suggests to me that something is right at least. ESP32 A is running this example ESP32 B is running the following code Note: I have change the debug levels on the various boards to rule out the performance issues introduced with lots of logging. This is not the issue here. I have searched for similar discussions and info on the wiki, but not found anything that has been trying to do quite what I have in mind. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
|
LOL, we are want to do almost the same thing, here. From what i can see in the ESPNowStream source code is that there is no control over from where an audio stream is coming from. All that is stored in on buffer. this will not work with SBC. Somehow we should split-up the incoming streams in to there own pipelines but i have no clue how we could catch those within the main program. At the moment i'm reworking the ESPNowStream so it allows to also broadcast the audio instead of using multicast as it is now. And i would love to add an unicast option as well. Working on the receiving side is next on my agenda. @dodds-cc lets work together to make an good solution for both of us. |
Beta Was this translation helpful? Give feedback.
-
|
@pschatzmann Could you advise the correct pattern to take an I2S input on physical pins, pass it through the SBC encoder and then onto ESP NOW for transmission? I've included some example code above where I am also converting the incoming I2S stream to |
Beta Was this translation helpful? Give feedback.
-
|
I don't see any reason why the input from another audio source should not work:
|
Beta Was this translation helpful? Give feedback.
No need to redesign anything: Just use your own receive callback to implement the mixing!