Snapcast is a multiroom client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio. It’s not a standalone player, but an extension that turns your existing audio player into a Sonos-like multiroom solution.

This week I have spent some time to work a new client for Arduino that should integrate with my AudioTools and I have a first DRAFT version that started to work.

Arduino Sketch

Here is the related Arduino Sketch that I have tested with an ESP32:

#include "AudioCodecs/CodecOpus.h"
#include "AudioTools.h"
#include "SnapClient.h"

#define ARDUINO_LOOP_STACK_SIZE (10 * 1024)

OpusAudioDecoder opus;
I2SStream out;
SnapClient client(out, opus);

void setup() {
  // login to wifi
  Serial.print("Connecting to WiFi ..");
  while (WiFi.status() != WL_CONNECTED) {

  // print ip address

  // setup I2S to define custom pins
  auto cfg = out.defaultConfig();
  config.pin_bck = 14;
  config.pin_ws = 15;
  config.pin_data = 22;

  // start snap client

void loop() { client.doLoop(); }

So we just need to pass the decoder and the output stream as argments to the constructor of the SnapClient object, start the Wifi and the client and call doLoop() in the Arduino loop!

To test it out I was executing the following command on my Linux Desktop: ffmpeg -i -f s16le -ar 48000 /tmp/snapfifo!

For further information please read the documentation in the project.

Open Topics

There are still a couple of additional things to do:

  • testing more codecs
  • adding additional support for playback synchronization
  • testing and issue resolution on other platforms

Please let me know if you want to work on any of these topics or if you have an further proposals



Final Comments

Please do not use the sketch from this page, but double check with the examples in the projects. I am not updating this page and I can’t guarantee that there are no changes to the API…


Leave a Reply

Avatar placeholder

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