7
7
### Feature list
8
8
9
9
- Header only C++ implementation
10
- - PCM, Opus, FLAC and Ogg decoding is supported
10
+ - PCM, Opus decoding is supported
11
11
- Auto connect to snapcast server on network
12
12
- The functionality has been tested on an ESP32
13
13
- Memory efficient implementation, so that PSRAM is not needed
14
14
- Use any output device or DSP chain suppored by the [ Audio Tools] ( https://github.com/pschatzmann/arduino-audio-tools )
15
+ - Flexible design so that you can choose from different processor implementations and synchronizers.
16
+
17
+ The disadvantage of these goals iw that you might need to fine tune the solution to have it working as you want.
15
18
16
19
### Description
17
20
@@ -24,11 +27,13 @@ Here is an example Arduino sketch that uses the Wifi as communication API, the W
24
27
``` C++
25
28
#include " AudioTools.h"
26
29
#include " SnapClient.h"
30
+ #include " AudioCodecs/CodecOpus.h" // https://github.com/pschatzmann/arduino-libopus
31
+ // #include "api/SnapProcessorRTOS.h" // install https://github.com/pschatzmann/arduino-freertos-addons
27
32
28
- WAVDecoder pcm ;
33
+ OpusAudioDecoder codec ;
29
34
WiFiClient wifi;
30
35
I2SStream out;
31
- SnapClient client (wifi, out, pcm );
36
+ SnapClient client (wifi, out, codec );
32
37
33
38
void setup() {
34
39
Serial.begin(115200);
@@ -50,8 +55,16 @@ void setup() {
50
55
config.pin_bck = 14;
51
56
config.pin_ws = 15;
52
57
config.pin_data = 22;
58
+ // cfg.buffer_size = 512;
59
+ // cfg.buffer_count = 40;
53
60
out.begin(cfg);
54
61
62
+ // Use FreeRTOS
63
+ //client.setSnapProcessor(rtos);
64
+
65
+ // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
66
+ // client.setServerIP(IPAddress(192,168,1,33));
67
+
55
68
// start snap client
56
69
client.begin();
57
70
}
@@ -61,7 +74,7 @@ void loop() {
61
74
}
62
75
63
76
```
64
- Change the snapserver.conf to define ```codec = pcm ``` and restart the snapserver with ```sudo service snapserver restart```.
77
+ Change the snapserver.conf to define ```codec = opus ``` and restart the snapserver with ```sudo service snapserver restart```.
65
78
You can test now your sketch e.g. with ```ffmpeg -i http://stream.srg-ssr.ch/m/rsj/mp3_128 -f s16le -ar 48000 /tmp/snapfifo```
66
79
67
80
For further information on codecs please check the information in the Wiki!
0 commit comments