Skip to content

Commit 66a260f

Browse files
committed
README
1 parent 7e546fd commit 66a260f

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,55 @@
1616

1717
I have converted the [snapclient](https://github.com/jorgenkraghjakobsen/snapclient) from Jørgen Kragh Jakobsen to an Arduino Library and integrated my AudioTools project to be used to define the output devices.
1818

19+
### Example Arduino Sketch
20+
21+
Here is an example Arduino sketch:
22+
23+
```C++
24+
#include "AudioTools.h"
25+
#include "SnapClient.h"
26+
#include "AudioCodecs/CodecOpus.h"
27+
28+
#define ARDUINO_LOOP_STACK_SIZE (10 * 1024)
29+
30+
OpusAudioDecoder opus;
31+
I2SStream out;
32+
SnapClient client(out, opus);
33+
34+
void setup() {
35+
Serial.begin(115200);
36+
// login to wifi
37+
WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
38+
Serial.print("Connecting to WiFi ..");
39+
while (WiFi.status() != WL_CONNECTED) {
40+
Serial.print('.');
41+
delay(1000);
42+
}
43+
44+
// print ip address
45+
Serial.println();
46+
Serial.println(WiFi.localIP());
47+
48+
// setup I2S to define custom pins
49+
auto cfg = out.defaultConfig();
50+
config.pin_bck = 14;
51+
config.pin_ws = 15;
52+
config.pin_data = 22;
53+
out.begin(cfg);
54+
55+
// start snap client
56+
client.begin();
57+
}
58+
59+
void loop() {
60+
client.doLoop();
61+
}
62+
```
63+
1964
### Dependencies
2065
2166
- [Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
67+
2268
- [LibOpus](https://github.com/pschatzmann/arduino-libopus)
2369
- [LibFLAC.h](https://github.com/pschatzmann/arduino-libflac)
2470
- [CodecVorbis](https://github.com/pschatzmann/arduino-libvorbis-idec)

examples/SnapClientAudioKit/SnapClientAudioKit.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include "SnapClient.h"
88
#include "AudioLibs/AudioKit.h"
99
#include "AudioCodecs/CodecOpus.h" // https://github.com/pschatzmann/arduino-libopus
10-
#include "AudioCodecs/CodecFLAC.h" // https://github.com/pschatzmann/arduino-libflac.git
11-
#include "AudioCodecs/CodecVorbis.h" //https://github.com/pschatzmann/arduino-libvorbis-idec
10+
//#include "AudioCodecs/CodecFLAC.h" // https://github.com/pschatzmann/arduino-libflac.git
11+
//#include "AudioCodecs/CodecVorbis.h" //https://github.com/pschatzmann/arduino-libvorbis-idec
1212

1313
#define ARDUINO_LOOP_STACK_SIZE (10 * 1024)
1414

0 commit comments

Comments
 (0)