Skip to content

Commit 8248001

Browse files
committed
AudioLib adampt examples, cleanup
1 parent 9e2999c commit 8248001

File tree

26 files changed

+357
-132
lines changed

26 files changed

+357
-132
lines changed

examples/examples-basic-api/base-file_mp3-a2dp/base-file_mp3-a2dp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <SD.h>
1616
#include "AudioFileSourceSD.h"
1717
#include "AudioGeneratorMP3.h"
18-
#include "AudioESP8266.h"
1918
#include "BluetoothA2DPSource.h"
2019
#include "AudioTools.h"
2120

examples/examples-basic-api/base-i2s-a2dp/base-i2s-a2dp.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
// Add this in your sketch or change the setting in AudioConfig.h
1111
#define USE_A2DP
1212

13-
#include "Arduino.h"
1413
#include "AudioTools.h"
15-
#include "AudioA2DP.h"
1614

1715
using namespace audio_tools;
1816

examples/examples-player/player-sd-a2dp/player-sd-a2dp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#define USE_SDFAT
1313

1414
#include "AudioTools.h"
15-
#include "AudioA2DP.h"
1615
#include "AudioCodecs/CodecMP3Helix.h"
1716

1817
using namespace audio_tools;

examples/examples-stream/streams-analog-serial/streams-analog-serial.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const uint16_t sample_rate = 44100;
1717
const uint8_t channels = 2;
1818
AnalogAudioStream in;
1919
CsvStream<int16_t> out(Serial, channels); // ASCII output stream
20-
StreamCopy copier(out, in); // copy i2sStream to a2dpStream
20+
StreamCopy copier(out, in); // copy i2sStream to CsvStream
2121
ConverterAutoCenter<int16_t> center; // set avg to 0
2222

2323
// Arduino Setup

examples/examples-stream/streams-generator-a2dp/streams-generator-a2dp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#define USE_A2DP
1313

1414
#include "AudioTools.h"
15-
#include "AudioA2DP.h"
1615

1716
using namespace audio_tools;
1817

examples/examples-stream/streams-i2s-a2dp/streams-i2s-a2dp.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
// Add this in your sketch or change the setting in AudioConfig.h
1111
#define USE_A2DP
1212

13-
#include "Arduino.h"
1413
#include "AudioTools.h"
15-
#include "AudioA2DP.h"
1614

1715
using namespace audio_tools;
1816

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Stream I2S Input to CSV Output
3+
4+
## General Description:
5+
We implement a A2DP source: We stream the sound input which we read in from the I2S interface and displays it on the Arduino Serial Plotter.
6+
7+
We can use any device which provides the sound data via I2S. In this case it is a 'I2S ADC Audio I2S Capture Card Module'
8+
9+
10+
## Pins
11+
12+
![i2s-adc](https://pschatzmann.github.io/arduino-audio-tools/resources/I2S-ADC.jpg)
13+
14+
15+
| i2s-ADC | ESP32
16+
| --------| ---------------
17+
| VDD | 3.3
18+
| GND | GND
19+
| SD | IN (GPIO32)
20+
| WS | WS (GPIO15)
21+
| SCK | BCK (GPIO14)
22+
23+
24+
- SCK: Serial data clock for I²S interface
25+
- WS: Select serial data words for the I²S interface
26+
- L/R: Left / right channel selection
27+
When set to low, the microphone emits signals on the left channel of the I²S frame.
28+
When the high level is set, the microphone will send signals on the right channel.
29+
- ExSD: Serial data output of the I²S interface
30+
- VCC: input power 1.8V to 3.3V
31+
- GND: Power groundHigh PSR: -75 dBFS.
32+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @file streams-i2s-csv.ino
3+
* @author Phil Schatzmann
4+
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/stream-i2s-csv/README.md
5+
*
6+
* @author Phil Schatzmann
7+
* @copyright GPLv3
8+
*/
9+
10+
11+
#include "AudioTools.h"
12+
13+
using namespace audio_tools;
14+
ConverterSwapBytes<int32_t> swap;
15+
ConverterOutlierFilter<int32_t> outlier;
16+
MultiConverter<int32_t> mc(outlier);
17+
18+
I2SStream i2sStream; // Access I2S as stream
19+
CsvStream<int32_t> csvStream(Serial);
20+
//HexDumpStream csvStream(Serial);
21+
StreamCopy copier(csvStream, i2sStream); // copy i2sStream to csvStream
22+
23+
// Arduino Setup
24+
void setup(void) {
25+
Serial.begin(115200);
26+
AudioLogger::instance().begin(Serial, AudioLogger::Info);
27+
28+
auto cfg = i2sStream.defaultConfig(RX_MODE);
29+
cfg.bits_per_sample = 32;
30+
cfg.channels = 2;
31+
cfg.sample_rate = 96000;
32+
cfg.is_master = false;
33+
cfg.i2s_format = I2S_MSB_FORMAT;
34+
i2sStream.begin(cfg);
35+
36+
// make sure that we have the correct channels set up
37+
csvStream.begin(cfg);
38+
39+
}
40+
41+
// Arduino loop - copy data
42+
void loop() {
43+
copier.copy(mc);
44+
}

examples/examples-webserver/streams-effect-webserver_wav/streams-effect-webserver_wav.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#include "AudioTools.h"
12-
#include "AudioExperiments.h"
1312

1413
using namespace audio_tools;
1514

examples/sandbox/experiment-effect_ads1015-webserver_wav/experiment-effect_ads1015-webserver_wav.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#include "AudioTools.h"
12-
#include "AudioExperiments.h"
1312
#include "ADS1X15.h"
1413

1514
using namespace audio_tools;

0 commit comments

Comments
 (0)