Skip to content

Commit 80659b8

Browse files
committed
Readme
1 parent 0c5e65b commit 80659b8

File tree

5 files changed

+69
-5
lines changed

5 files changed

+69
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ As “Audio Sinks” we will have e.g:
5858
- Tensorflow Lite - [TfLiteAudioStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_tf_lite_audio_stream.html)
5959
- Converting Streams - [VolumeStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_volume_stream.html), [ResampleStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_resample_stream.html), [FormatConverterStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_format_converter_stream.html), [NumberFormatConverterStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_number_format_converter_stream.html), [ChannelFormatConverterStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_channel_format_converter_stream.html), [ConvertedStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_converted_stream.html)
6060
- Communication - [ESPNowStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_e_s_p_now_stream.html), [UDPStream](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_u_d_p_stream.html)
61+
- Multiuser-Webserver for PCM Output - [AudioWAVServerEx](https://pschatzmann.github.io/arduino-audio-tools/html/classaudio__tools_1_1_audio_w_a_v_server_ex.html)
6162
- Any other Arduino Classes implementing Streams: SD, Ethernet etc
6263

6364
### Examples
@@ -137,8 +138,8 @@ Dependent on the example you might need to install some of the following librari
137138
- [rp2040-i2s](https://github.com/pschatzmann/rp2040-i2s) I2S library for MBED RP2040
138139
- [SdFat Library](https://github.com/greiman/SdFat) to read and write files supporting SD cards with FAT16/FAT32 and exFAT
139140
- [SD Library](https://www.arduino.cc/en/reference/SD) to read and write files supporting SD cards with FAT16 and FAT32
141+
- [TinyHttp](https://github.com/pschatzmann/TinyHttp) a http server that also supports audio for multiple users
140142

141-
After installing a library, you might need to activate it's usage in the ```AudioConfig.h``` file!
142143

143144
## Show and Tell
144145

examples/examples-webserver/streams-generator-webserverex_wav/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
With the help of the ESP32 WIFI functionality we can implement a simple web server.
44
In the example we use a Sine Wave generator as sound source and return the result as an WAV file
55

6+
The server can be used like any other output stream and we can use a StreamCopy to provide it with data.
7+
68
Multiple users can connect to the server!
79

810
## Dependencies

examples/examples-webserver/streams-generator-webserverex_wav/streams-generator-webserverex_wav.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
// WIFI
1515
const char *ssid = "Phil Schatzmann";
1616
const char *password = "sabrina01";
17-
AudioWAVServerEx server;
18-
// Sound Generation
1917
const int sample_rate = 10000;
2018
const int channels = 1;
19+
2120
SineWaveGenerator<int16_t> sineWave; // Subclass of SoundGenerator with max amplitude of 32000
2221
GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
22+
AudioWAVServerEx server;
23+
StreamCopy copier(server, in); // copy mic to tfl
2324

2425

2526
void setup() {
@@ -33,7 +34,6 @@ void setup() {
3334
cfg.channels = channels;
3435
cfg.ssid = ssid;
3536
cfg.password = password;
36-
cfg.input = &in;
3737
server.begin(cfg);
3838

3939
// start generation of sound
@@ -44,5 +44,5 @@ void setup() {
4444

4545
// copy the data
4646
void loop() {
47-
server.copy();
47+
copier.copy();
4848
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Webserver
2+
3+
With the help of the ESP32 WIFI functionality we can implement a simple web server.
4+
In the example we use a Sine Wave generator as sound source and return the result as an WAV file
5+
6+
The input is defied as part of the configuration
7+
8+
Multiple users can connect to the server!
9+
10+
## Dependencies
11+
12+
- https://github.com/pschatzmann/arduino-audio-tools
13+
- https://github.com/pschatzmann/TinyHttp.git
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @file streams-generator-server_wav.ino
3+
*
4+
* This sketch generates a test sine wave. The result is provided as WAV stream which can be listened to in a Web Browser
5+
*
6+
* @author Phil Schatzmann
7+
* @copyright GPLv3
8+
*
9+
*/
10+
11+
#include "AudioTools.h"
12+
#include "AudioLibs/AudioServerEx.h"
13+
14+
// WIFI
15+
const char *ssid = "Phil Schatzmann";
16+
const char *password = "sabrina01";
17+
const int sample_rate = 10000;
18+
const int channels = 1;
19+
20+
SineWaveGenerator<int16_t> sineWave; // Subclass of SoundGenerator with max amplitude of 32000
21+
GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
22+
AudioWAVServerEx server;
23+
24+
25+
void setup() {
26+
Serial.begin(115200);
27+
AudioLogger::instance().begin(Serial,AudioLogger::Info);
28+
HttpLogger.setLevel(tinyhttp::Info);
29+
30+
// start server
31+
auto cfg = server.defaultConfig();
32+
cfg.sample_rate = sample_rate;
33+
cfg.channels = channels;
34+
cfg.ssid = ssid;
35+
cfg.password = password;
36+
cfg.input = &in; // Define input
37+
server.begin(cfg);
38+
39+
// start generation of sound
40+
sineWave.begin(channels, sample_rate, N_B4);
41+
in.begin();
42+
}
43+
44+
45+
// copy the data
46+
void loop() {
47+
server.copy();
48+
}

0 commit comments

Comments
 (0)