Quite some time ago, I demonstrated how you can send Audio to your mobile phone using the VBAN protocol. Recently I have added support for receiving data to your microcontroller as well. With this you can use this protocol to build some cool two way communictations applications (e.g. walkie-talkie).

Arduino Sketch

Here is a sketch that receives the data and just outputs the audio with I2S. Just replace the output class with whatever you want!


#include "AudioTools.h" #include "AudioLibs/VBANStream.h" #include "AudioLibs/AudioBoardStream.h" // comment out when not using AudioKit I2SStream out; // Audio Destination VBANStream in; // Audio Source StreamCopy copier(out, in); // copies sound into i2s // Arduino Setup void setup(void) { // Open Serial Serial.begin(115200); while(!Serial); AudioLogger::instance().begin(Serial, AudioLogger::Info); // setup output auto cfg_out = out.defaultConfig(TX_MODE); if (!out.begin(cfg_out)) stop(); // format changes in vban must change the output as well in.setNotifyAudioChange(out); // setup input from vban auto cfg_in = in.defaultConfig(RX_MODE); cfg_in.ssid = "ssid"; cfg_in.password = "password"; cfg_in.stream_name = "Talkie"; in.begin(cfg_in); } // Arduino loop - copy sound to out void loop() { copier.copy(); }

Just can just open the output and the input by providing some parameters.
The critical thing is, that you indicate to forward format changes to the output, so that any sample rate changes or changes to the number of channels is rendered properly.

For the time being only 16 data is supported.

Dependencies

You need to have the following libraries installed:

Updated Source Code

This and other VBAN examples can be found on Github. Please use the (potentially updated) code from Github.


1 Comment

veit · 3. March 2024 at 8:51

two way walkie talkie …. very interesting 🙂

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *