Skip to content

Commit 40c2971

Browse files
committed
some failed experiments
1 parent faaff93 commit 40c2971

File tree

14 files changed

+93188
-117
lines changed

14 files changed

+93188
-117
lines changed

sandbox/.DS_Store

0 Bytes
Binary file not shown.

sandbox/a2dp-file_aac/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# A2DP Sink writing AAC files to SD Drive
2+
3+
Usually the A2DP Sink is just sending the audio data to I2S. However we can send the output somwhere else.
4+
5+
## Warning
6+
7+
The example is crashing because there is not enugh stack space
8+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "Arduino.h"
2+
#include <SPI.h>
3+
#include <SD.h>
4+
#include "AudioTools.h"
5+
#include "BluetoothA2DPSink.h"
6+
7+
// configuration
8+
const int sd_ss_pin = 4;
9+
10+
// common data
11+
BluetoothA2DPSink a2dp_sink;
12+
File sound_file;
13+
AACEncoder *encoder;
14+
15+
// detrmines the next file name
16+
char* nextFileName(){
17+
static int idx;
18+
static char[10] result;
19+
sprintf(result,"F%000d", ++idx);
20+
return result;
21+
}
22+
23+
// opens a new file
24+
void openFile() {
25+
Serial.println("Recording next file...");
26+
// save and cleanup of last file
27+
sound_file.close();
28+
if encoder != nullptr delete encoder;
29+
30+
// new file
31+
dataFile = SD.open(nextFileName(), FILE_WRITE);
32+
encoder = new AACEncoder(dataFile);
33+
encoder->begin();
34+
}
35+
36+
// Get the audio data from A2DP to save it in a file
37+
void read_data_stream(const uint8_t *data, uint32_t length) {
38+
if (encoder!=nullptr) encoder.write(data, len);
39+
}
40+
41+
// Handle meta data changes
42+
void avrc_metadata_callback(uint8_t data1, const uint8_t *data2) {
43+
Serial.printf("AVRC metadata rsp: attribute id 0x%x, %s\n", data1, data2);
44+
openFile()
45+
}
46+
47+
void setup() {
48+
Serial.begin(115200);
49+
50+
// setup A2DP
51+
a2dp_sink.set_stream_reader(read_data_stream);
52+
a2dp_sink.set_avrc_metadata_callback(avrc_metadata_callback);
53+
a2dp_sink.start("AAC-Recorder");
54+
55+
// Setup SD
56+
SD.begin(sd_ss_pin);
57+
}
58+
59+
60+
void loop() {
61+
}

sandbox/ads1015-i2s/README.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

sandbox/ads1015-i2s/ads1015-i2s.ino

Lines changed: 0 additions & 48 deletions
This file was deleted.

sandbox/ads1015-serial/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ The ADS1015 is a 12 bit ADC which is connected via I2C.
1515
| ADDR | GND
1616
| ALRT | -
1717
| A0 | Analog Source (e.g. Electic Guitar)
18+
19+
20+
## Conclusion
21+
22+
The sampling rate is too low to be usefull.

sandbox/flash_midi-a2dp/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Stream In Memory Midi to A2DP Bluetooth using the ESP8266Audio Library
2+
3+
The ESP32 can store only a limited amount of RAW data fully in the memory: Usually it's just sufficient for a couple of seconds. The memory wise most efficient file format is MIDI! By using MIDI we can easiy store one or even multiple pieces of music in the Flash Memory.
4+
5+
We can play MIDI with the [ESP8266Audio](https://github.com/earlephilhower/ESP8266Audio) library.
6+
7+
And the nice thing: there is no need for a SD drive or any other additional hardware!
8+
9+
## Compile Settings
10+
11+
Set the Partition Scheme to Huge APP
12+
13+
14+
## Warning
15+
The quality is pretty bad !
16+
Reason to be investigated...

0 commit comments

Comments
 (0)