WebRadio with 2 ESP32s via I2S streaming to an ordinary BluetoothBox via A2DP #1748
Replies: 6 comments 8 replies
-
Don't use I2S to communicate audio between the 2 ESP32: I think this is just not working reliably. |
Beta Was this translation helpful? Give feedback.
-
Now it works, even via i2s! The glitches are gone. According to this comment I now resample the mp3-stream to 44100 kHz. So the program for the first ESP32 now looks like this:
Only after a minute or so the wdr-maus-stream jumps, I don't know why. But the Jazz-Radio-stream runs perfectly. I assume resampling costs even more cpu power. Since the above program works now, cpu power seems not the problem, but different sample-rates of server and master of the i2s-routine of the first approach. |
Beta Was this translation helpful? Give feedback.
-
I was wondering if it wouldn't be better to let the second ESP32 do the resampling: If I want to build an advanced radio, the first ESP32 will have to do much more work (Display, nextSender-button, volume, ...), and the second ESP32 is not exhausted anyway. So I kept the first sketch for the first ESP32 and changed the program for the second one. It works as well:
Well, there is a little disadvantage: In case of restarting the first ESP32, the sound has glitches again. I think, this is due to the fact that the ESPs then are not synchronized correctly any more. Perhaps this time I need a kind of addNotifyAudioChange-command? But I think the advantage is, that the i2s-stream with 48kHz is more compatible to other projects: I nearly managed to run the second ESP32 as i2s->bluetooth-sink for kaRadio with this approach... |
Beta Was this translation helpful? Give feedback.
-
Hello! I was trying to create a web radio that streams audio directly to a Bluetooth speaker using A2DP. I started by trying to accomplish this with a single ESP32. After numerous attempts, I learned several things. While some might be obvious to experienced developers, I'll document them here for anyone searching for a solution: Hardware Considerations:
Software Considerations:
After all these struggles I am glad that I found this discussion. Sorry for hijacking the discussion and for the long post. I have one question regarding two things:
|
Beta Was this translation helpful? Give feedback.
-
I tried both (128mHz and 48mHz) versions from here. I found the issues for one particular stream: Today I burned yoRadio on first ESP32. So I was able to play the same (previously broken 128kHz) stream. I also matched the I2S pins of the two ESPs so I do not need to remember them. About cracking noise:
For 3) and 4) most of the time this stream works without cracking. Or maybe I can't hear it because of the type of music. Since you did not experience those I started to believe that this is a hardware issue. So I tried those things:
The cracking noise is still there and I cannot find the root cause. The stream that I am testing on is 128mHz. |
Beta Was this translation helpful? Give feedback.
-
After writing this post I tried one more time. This time there was no audio input (after trying every booting sequence cable and power supply). One of the pins was not making good contact although soldered in place. Maybe we can proceed with improving device (2). |
Beta Was this translation helpful? Give feedback.
-
I tried to build an Internet-Radio that uses any Bluetooth sink to play an mp3-stream on my Bluetooth-Box. Since Bluetooth and Wifi cannot be used simultaneously, I wanted to use two ESP32, one that converts the mp3-stream into a i2s-Stream and another that outputs the i2s-signals via a2dp to the bluetooth sink.
I use two NodeMCU ESP32-Development-Boards, which are connected as the following:
The first ESP32 is programmed with the following code (adapted from Phils example-program player-url-i2s)
The second ESP32 is flashed with the following program (adapted from steams-i2s-a2dp):
Two points have been important: the first ESP has to be set as master of the i2s-stream, the second as slave (
cfg.is_master = false;
). And secondly, any debug-information via Serial does disrupt the stream.I am using version 1.0.0 from the arduino-audio-tools library, as well as the libhelix library from Phil. The ESPs have to be flashed with partition-scheme "HugeApp".
Up to now, it works quite promising, but after the first second, every 200ms or so there is some disruption of the stream. Has anybody an idea, how to get rid of this? I suppose, it's an performance/timing-problem, but I have no idea, how to optimize the code.
Beta Was this translation helpful? Give feedback.
All reactions