Using UDP multicast example to share audio
Posted: Thu Jul 12, 2018 12:27 pm
Hi everyone,
I'm currently working on a bluetooth speaker project, and what i'm trying to do now is to create a network to share the audio between several speakers. I tried first to investigate solutions with the ESP-MDF, but apparently the mesh network doesn't support audio yet.
So i decided to switch from mesh to my own Wi-Fi network, started to learn about Wi-Fi in general and its protocols, and found that apparently UDP is probably the best for audio sharing, as it's not necessary to establish a secured connection between the server and the client, and also no need to recover a lost audio packet when talking about streming. So I started to work with the UDP multicast example (https://github.com/espressif/esp-idf/tr ... _multicast), which work fine, as long as i'm using an external Access Point, but not when one of the ESP is the access point.
Let me explain this in more details: in my case, i want to have one speaker acting as a server, with which i can connect with my phone to or whatever by bluetooth, sending this one audio, which will share audio to one or many other speakers (clients).
But for my first tests, I didn't start with audio, but only some message (less than 40 bytes) every 1 or 2 seconds.
- I tried first with two ESP boards: first as sender and access point, second one as receiver, connected to the first one. I'm losing a lot of packets (more than 90%).
- Then I tried to use my phone as the access point for both boards, still having the first sending packets, and second one receiving them: i've got very good results, like losing less than 5% of the packets.
- Finally, i replace my phone with a third board acting only like access point, not sending or receiving anything, just used the simple_wifi example set as access point. Again, i'm losing loads of packets.
So i arrived at the conclusion that the problem must comes from the ESP configured as Access Point. So my question is the following: do you know if there are some parameters that i can change to improve the performance of the ESP when it turns to be Access Point? Or do you think something else could work better than multicast?
Any help will be gratefully received.
I'm currently working on a bluetooth speaker project, and what i'm trying to do now is to create a network to share the audio between several speakers. I tried first to investigate solutions with the ESP-MDF, but apparently the mesh network doesn't support audio yet.
So i decided to switch from mesh to my own Wi-Fi network, started to learn about Wi-Fi in general and its protocols, and found that apparently UDP is probably the best for audio sharing, as it's not necessary to establish a secured connection between the server and the client, and also no need to recover a lost audio packet when talking about streming. So I started to work with the UDP multicast example (https://github.com/espressif/esp-idf/tr ... _multicast), which work fine, as long as i'm using an external Access Point, but not when one of the ESP is the access point.
Let me explain this in more details: in my case, i want to have one speaker acting as a server, with which i can connect with my phone to or whatever by bluetooth, sending this one audio, which will share audio to one or many other speakers (clients).
But for my first tests, I didn't start with audio, but only some message (less than 40 bytes) every 1 or 2 seconds.
- I tried first with two ESP boards: first as sender and access point, second one as receiver, connected to the first one. I'm losing a lot of packets (more than 90%).
- Then I tried to use my phone as the access point for both boards, still having the first sending packets, and second one receiving them: i've got very good results, like losing less than 5% of the packets.
- Finally, i replace my phone with a third board acting only like access point, not sending or receiving anything, just used the simple_wifi example set as access point. Again, i'm losing loads of packets.
So i arrived at the conclusion that the problem must comes from the ESP configured as Access Point. So my question is the following: do you know if there are some parameters that i can change to improve the performance of the ESP when it turns to be Access Point? Or do you think something else could work better than multicast?
Any help will be gratefully received.