Skip to content

Communication

Phil Schatzmann edited this page Mar 4, 2025 · 29 revisions

You can transmit audio information over a wire or (e.g. if you have an ESP32) wirelessly. It is important that you make sure that the transmitted amount of audio data is below the transmission capacity of the medium (e.g. by limiting the channels, the sample rate or the bits per sample).

For a sample rate of 44100 with 2 channels and 16 bit data you need to be able to transmit faster then 44100 * 2 channels * 2 bytes = 176400 bytes per second. Using a serial communication with a stop bit this gives 176400 * 9 = 1'587'600 bps!

Therefore should also consider to use one of the many supported CODECs to decrease the transmitted amount of data!

I can recommend the following codecs for this purpuse:

Network

Networking is considered to be part of the core functionality of this library. In the AudioConfig.h you can define the networking functionality that should be activated

#define USE_ETHERNET  // Use the Arduino Ethernet library (e.g. for the Ethernet Shield)
#define USE_WIFI      // Use the (ESP) WiFi library
#define USE_AUDIO_SERVER // Activate the Server functionality
#define USE_URL_ARDUINO  // Activate the URLStream

Protocols

I am currently providing examples for:

HTTP Client

The following classes can be used as HTTP Client and implement the AbstractURLStream API.

  • URLStream: Supports HTTP GET, POST, PUT and DELETE
  • ICYStream: Supports the ICY protocol
  • URLStreamBuffered: Using buffer that is filled by a task
  • ICYStreamBuffered: Using buffer that is filled by a task

The above classes are dependent on the Arduino Networking API. I thought that it would be cool to have this functionality also working for the ESP32 outside of Arduino. The following implementations just depend on the IDF:

  • URLStreamESP32
  • ICYStreamESP32
  • URLStreamBufferedESP32
  • ICYStreamBufferedESP32

Further information can be found in my blogs...

Clone this wiki locally