Skip to content

Commit e2c1244

Browse files
committed
README
1 parent 263f6b2 commit e2c1244

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ This is currently work in progress:
151151
| I2S | tested |
152152
| Files (RAW, MP3...) | tested |
153153
| Streams | tested |
154-
| WAV encoding/deconding | tested |
154+
| WAV encoding/deconding | tested |
155155
| AAC encoding/deconding | open |
156156
| int24_t | tested |
157157

examples/streams-generator-webserver_wav/streams-generator-server_wav.ino

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
using namespace audio_tools;
55

6+
// WIFI
67
const char *ssid = "ssid";
78
const char *password = "password";
89
WiFiServer server(80);
910
WiFiClient client;
1011

12+
// Sound Generation
1113
const int sample_rate = 10000;
1214
const int data_length = 100000;
1315
const int channels = 1;
@@ -18,14 +20,13 @@ StreamCopy copier; // buffered copy
1820
WAVEncoder encoder;
1921
AudioOutputStream wav_stream(encoder); // WAV output stream
2022

21-
void setup()
22-
{
23+
24+
void setup() {
2325
Serial.begin(115200);
2426
AudioLogger::instance().begin(Serial,AudioLogger::Debug);
2527

2628
WiFi.begin(ssid, password);
27-
while (WiFi.status() != WL_CONNECTED)
28-
{
29+
while (WiFi.status() != WL_CONNECTED) {
2930
delay(500);
3031
Serial.print(".");
3132
}
@@ -35,13 +36,15 @@ void setup()
3536
Serial.println("IP address: ");
3637
Serial.println(WiFi.localIP());
3738

39+
// start server
3840
server.begin();
39-
sineWave.begin(sample_rate, B4);
4041

42+
// start generation of sound
43+
sineWave.begin(sample_rate, B4);
4144
in.begin();
4245
}
4346

44-
47+
// Handle an new client connection and return the data
4548
void processClient() {
4649
if (client) { // if you get a client,
4750
Serial.println("New Client."); // print a message out the serial port
@@ -86,6 +89,7 @@ void processClient() {
8689
}
8790
}
8891

92+
// copy the data
8993
void loop() {
9094
if (!client.connected()) {
9195
client = server.available(); // listen for incoming clients
@@ -94,6 +98,7 @@ void loop() {
9498
// We are connected: copy input from source to wav output
9599
if (encoder){
96100
copier.copy();
101+
// if we limit the size of the WAV the encoder gets automatically closed when all has been sent
97102
if (!encoder) {
98103
Serial.println("stop client...");
99104
client.stop();
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Decoding a WAV file
2-
3-
In this example we decode a WAV file into RAW output and send it to the Serial output. The audio chain is:
1+
# Decoding a WAV file
42

3+
In this example we decode a WAV file into RAW output and send it to the Serial output. The audio processing chain is:
4+
55
MemoryStream -> AudioOutputStream -> WAVDecoder -> CsvStream

0 commit comments

Comments
 (0)