snapshot
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# AudioKit
|
||||
Please read the [Audio Boards Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Audio-Boards) first.
|
||||
|
||||
These sketches work on the AI Thinker AudioKit, the LyraT or any other board that is supported by the [arduino-audio-driver](https://github.com/pschatzmann/arduino-audio-driver) library.
|
||||
|
||||
If you want to use them on any other board, you just pass the corresponding board variable in the constructor or you compose your own board. Further information can be found in [this Wiki](https://github.com/pschatzmann/arduino-audio-driver/wiki).
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
# Stream Input from an AudioKit to AudioKit Output
|
||||
|
||||
## General Description:
|
||||
|
||||
We implement a AudioKit source and sink: We stream the sound input which we read in from the I2S interface and write it back via I2S to the Speaker
|
||||
|
||||
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file streams-audiokit-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-audiokit/README.md
|
||||
*
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||
StreamCopy copier(kit, kit); // copy kit to kit
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = false;
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* @file audiokit-effects-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Some Guitar Effects that can be controlled via a Web Gui.
|
||||
* @version 0.1
|
||||
* @date 2022-10-14
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include <ArduinoJson.h> // https://arduinojson.org/
|
||||
#include "HttpServer.h" // https://github.com/pschatzmann/TinyHttp
|
||||
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools.git
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h" // https://github.com/pschatzmann/arduino-audio-driver.git
|
||||
|
||||
// Server
|
||||
WiFiServer wifi;
|
||||
HttpServer server(wifi);
|
||||
const char *ssid = "SSID";
|
||||
const char *password = "PASSWORD";
|
||||
|
||||
// Audio Format
|
||||
const int sample_rate = 44100;
|
||||
const int channels = 1;
|
||||
const int bits_per_sample = 16;
|
||||
|
||||
// Effects control input
|
||||
float volumeControl = 0.1;
|
||||
int16_t clipThreashold = 0;
|
||||
float fuzzEffectValue = 0;
|
||||
int16_t fuzzMaxValue = 0;
|
||||
int16_t tremoloDuration = 0;
|
||||
float tremoloDepth = 0;
|
||||
|
||||
// Effects
|
||||
Boost boost(volumeControl);
|
||||
Distortion distortion(clipThreashold);
|
||||
Fuzz fuzz(fuzzEffectValue);
|
||||
Tremolo tremolo(tremoloDuration, tremoloDepth, sample_rate);
|
||||
|
||||
// Audio
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||
AudioEffectStream effects(kit); // input from kit
|
||||
StreamCopy copier(kit, effects); // copy effects to kit
|
||||
|
||||
// Update values in effects
|
||||
void updateValues(){
|
||||
// update values in controls
|
||||
boost.setVolume(volumeControl);
|
||||
boost.setActive(volumeControl>0);
|
||||
distortion.setClipThreashold(clipThreashold);
|
||||
distortion.setActive(clipThreashold>0);
|
||||
fuzz.setFuzzEffectValue(fuzzEffectValue);
|
||||
fuzz.setMaxOut(fuzzMaxValue);
|
||||
fuzz.setActive(fuzzEffectValue>0);
|
||||
tremolo.setDepth(tremoloDepth);
|
||||
tremolo.setDuration(tremoloDuration);
|
||||
tremolo.setActive(tremoloDuration>0);
|
||||
}
|
||||
|
||||
// provide JSON as webservice
|
||||
void getJson(HttpServer * server, const char*requestPath, HttpRequestHandlerLine * hl) {
|
||||
auto parameters2Json = [](Stream & out) {
|
||||
DynamicJsonDocument doc(1024);
|
||||
doc["volumeControl"]["value"] = volumeControl;
|
||||
doc["volumeControl"]["min"] = 0;
|
||||
doc["volumeControl"]["max"] = 1;
|
||||
doc["volumeControl"]["step"] = 0.1;
|
||||
doc["clipThreashold"]["value"] = clipThreashold;
|
||||
doc["clipThreashold"]["min"] = 0;
|
||||
doc["clipThreashold"]["max"] = 6000;
|
||||
doc["clipThreashold"]["step"] = 100;
|
||||
doc["fuzzEffectValue"]["value"] = fuzzEffectValue;
|
||||
doc["fuzzEffectValue"]["min"] = 0;
|
||||
doc["fuzzEffectValue"]["max"] = 10;
|
||||
doc["fuzzEffectValue"]["step"] = 0.1;
|
||||
doc["fuzzMaxValue"]["value"] = fuzzMaxValue;
|
||||
doc["fuzzMaxValue"]["min"] = 0;
|
||||
doc["fuzzMaxValue"]["max"] = 32200;
|
||||
doc["fuzzMaxValue"]["step"] = 1;
|
||||
doc["tremoloDuration"]["value"] = tremoloDuration;
|
||||
doc["tremoloDuration"]["min"] = 0;
|
||||
doc["tremoloDuration"]["max"] = 2000;
|
||||
doc["tremoloDuration"]["step"] = 1;
|
||||
doc["tremoloDepth"]["value"] = tremoloDepth;
|
||||
doc["tremoloDepth"]["min"] = 0;
|
||||
doc["tremoloDepth"]["max"] = 100;
|
||||
doc["tremoloDepth"]["step"] = 1;
|
||||
serializeJson(doc, out);
|
||||
};
|
||||
|
||||
// provide data as json using callback
|
||||
server->reply("text/json", parameters2Json, 200);
|
||||
};
|
||||
|
||||
|
||||
// Poroces Posted Json
|
||||
void postJson(HttpServer *server, const char*requestPath, HttpRequestHandlerLine *hl) {
|
||||
// post json to server
|
||||
DynamicJsonDocument doc(1024);
|
||||
deserializeJson(doc, server->client());
|
||||
volumeControl = doc["volumeControl"];
|
||||
clipThreashold = doc["clipThreashold"];
|
||||
fuzzEffectValue = doc["fuzzEffectValue"];
|
||||
fuzzMaxValue = doc["fuzzMaxValue"];
|
||||
tremoloDuration = doc["tremoloDuration"];
|
||||
tremoloDepth = doc["tremoloDepth"];
|
||||
|
||||
// update values in controls
|
||||
updateValues();
|
||||
|
||||
server->reply("text/json", "{}", 200);
|
||||
char msg[120];
|
||||
snprintf(msg, 120, "====> updated values %f %d %f %d %d %f", volumeControl, clipThreashold, fuzzEffectValue, tremoloDuration, tremoloDepth);
|
||||
Serial.println(msg);
|
||||
}
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// Setup Server
|
||||
static HttpTunnel tunnel_url("https://pschatzmann.github.io/TinyHttp/app/guitar-effects.html");
|
||||
server.on("/", T_GET, tunnel_url);
|
||||
server.on("/service", T_GET, getJson);
|
||||
server.on("/service", T_POST, postJson);
|
||||
server.begin(80, ssid, password);
|
||||
server.setNoConnectDelay(0);
|
||||
|
||||
// Setup Kit
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = false;
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
cfg.sample_rate = sample_rate;
|
||||
cfg.channels = channels;
|
||||
// minimize lag
|
||||
cfg.buffer_count = 2;
|
||||
cfg.buffer_size = 256;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(1.0);
|
||||
|
||||
// setup effects
|
||||
effects.addEffect(boost);
|
||||
effects.addEffect(distortion);
|
||||
effects.addEffect(fuzz);
|
||||
effects.addEffect(tremolo);
|
||||
effects.begin(cfg);
|
||||
|
||||
updateValues();
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
server.copy();
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file streams-audiokit-fft-led.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief We peform FFT on the microphone input of the AudioKit and display the
|
||||
* result on a 32*8 LED matrix
|
||||
* @version 0.1
|
||||
* @date 2022-10-14
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include <FastLED.h> // to prevent conflicts introduced with 3.9
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or AudioKissFFT
|
||||
#include "AudioTools/AudioLibs/LEDOutput.h"
|
||||
|
||||
#define PIN_LEDS 22
|
||||
#define LED_X 32
|
||||
#define LED_Y 8
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||
AudioRealFFT fft; // or AudioKissFFT
|
||||
FFTDisplay fft_dis(fft);
|
||||
LEDOutput led(fft_dis); // output to LED matrix
|
||||
StreamCopy copier(fft, kit); // copy mic to fft
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup Audiokit as input device
|
||||
auto cfg = kit.defaultConfig(RX_MODE);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
|
||||
// Setup FFT output
|
||||
auto tcfg = fft.defaultConfig();
|
||||
tcfg.length = 1024;
|
||||
tcfg.copyFrom(cfg);
|
||||
fft.begin(tcfg);
|
||||
|
||||
// Setup FFT Display
|
||||
fft_dis.fft_group_bin = 3;
|
||||
fft_dis.fft_start_bin = 0;
|
||||
fft_dis.fft_max_magnitude = 40000;
|
||||
fft_dis.begin();
|
||||
|
||||
// Setup LED matrix output
|
||||
auto lcfg = led.defaultConfig();
|
||||
lcfg.x = LED_X;
|
||||
lcfg.y = LED_Y;
|
||||
led.begin(lcfg);
|
||||
|
||||
// add LEDs
|
||||
FastLED.addLeds<WS2812B, PIN_LEDS, GRB>(led.ledData(), led.ledCount());
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// update FFT
|
||||
copier.copy();
|
||||
// update LEDs
|
||||
led.update();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
## FFT
|
||||
|
||||
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board.
|
||||
|
||||
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||
|
||||
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies
|
||||
|
||||
The fast Fourier transform (FFT) can be used to determine the frequencies of a singal. More [details can be found in the Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/FFT)
|
||||
|
||||
### Note
|
||||
|
||||
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or AudioKissFFT
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||
AudioRealFFT fft; // or AudioKissFFT
|
||||
StreamCopy copier(fft, kit); // copy mic to tfl
|
||||
int channels = 2;
|
||||
int samples_per_second = 44100;
|
||||
int bits_per_sample = 16;
|
||||
float value=0;
|
||||
|
||||
// display fft result
|
||||
void fftResult(AudioFFTBase &fft){
|
||||
float diff;
|
||||
auto result = fft.result();
|
||||
if (result.magnitude>100){
|
||||
Serial.print(result.frequency);
|
||||
Serial.print(" ");
|
||||
Serial.print(result.magnitude);
|
||||
Serial.print(" => ");
|
||||
Serial.print(result.frequencyAsNote(diff));
|
||||
Serial.print( " diff: ");
|
||||
Serial.println(diff);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// setup Audiokit
|
||||
auto cfg = kit.defaultConfig(RX_MODE);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
cfg.channels = channels;
|
||||
cfg.sample_rate = samples_per_second;
|
||||
cfg.bits_per_sample = bits_per_sample;
|
||||
kit.begin(cfg);
|
||||
|
||||
// Setup FFT
|
||||
auto tcfg = fft.defaultConfig();
|
||||
tcfg.length = 8192;
|
||||
tcfg.channels = channels;
|
||||
tcfg.sample_rate = samples_per_second;
|
||||
tcfg.bits_per_sample = bits_per_sample;
|
||||
tcfg.callback = &fftResult;
|
||||
fft.begin(tcfg);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file streams-kit-filter-kit.ino
|
||||
* @brief Copy audio from I2S to I2S using an FIR filter
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
|
||||
// copy filtered values
|
||||
FilteredStream<int16_t, float> filtered(kit, info.channels); // Defiles the filter as BaseConverter
|
||||
StreamCopy copier(filtered, kit); // copies sound into i2s (both from kit to filtered or filered to kit are supported)
|
||||
|
||||
// define FIR filter
|
||||
float coef[] = { 0.021, 0.096, 0.146, 0.096, 0.021};
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
// change to Warning to improve the quality
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup filters for all available channels
|
||||
filtered.setFilter(0, new FIR<float>(coef));
|
||||
filtered.setFilter(1, new FIR<float>(coef));
|
||||
|
||||
// start I2S in
|
||||
Serial.println("starting KIT...");
|
||||
auto config = kit.defaultConfig(RXTX_MODE);
|
||||
config.copyFrom(info);
|
||||
config.sd_active = false;
|
||||
config.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(config);
|
||||
|
||||
Serial.println("KIT started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Example for DTMF detection using Goertzel algorithm
|
||||
// Uses AudioKit and I2S microphones as input
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16); // 8kHz, mono, 16 bits
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||
//CsvOutput<int16_t> out(Serial, 1);
|
||||
GoertzelStream goertzel; //(out);
|
||||
StreamCopy copier(goertzel, kit); // copy kit to georzel
|
||||
|
||||
// represent DTMF keys
|
||||
class DTMF {
|
||||
public:
|
||||
enum Dimension { Row, Col };
|
||||
DTMF() = default;
|
||||
DTMF(Dimension d, int i) {
|
||||
if (d == Row)
|
||||
row = i;
|
||||
else
|
||||
col = i;
|
||||
}
|
||||
void clear() {
|
||||
row = -1;
|
||||
col = -1;
|
||||
}
|
||||
char getChar() {
|
||||
if (row == -1 || col == -1) return '?';
|
||||
return keys[row][col];
|
||||
}
|
||||
int row = -1;
|
||||
int col = -1;
|
||||
const char* keys[4] = {"123A", "456B", "789C", "*0#D"};
|
||||
} actual_dtmf;
|
||||
|
||||
// combine row and col information
|
||||
void GoetzelCallback(float frequency, float magnitude, void* ref) {
|
||||
DTMF* dtmf = (DTMF*)ref;
|
||||
LOGW("Time: %lu - Hz: %f Mag: %f", millis(), frequency, magnitude);
|
||||
// we get either row or col information
|
||||
if (dtmf->row != -1) {
|
||||
actual_dtmf.row = dtmf->row;
|
||||
} else {
|
||||
actual_dtmf.col = dtmf->col;
|
||||
|
||||
// print detected key
|
||||
Serial.println(actual_dtmf.getChar());
|
||||
actual_dtmf.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// start audio input from microphones
|
||||
auto cfg = kit.defaultConfig(RX_MODE);
|
||||
cfg.copyFrom(info);
|
||||
cfg.sd_active = false;
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
cfg.use_apll = false;
|
||||
kit.begin(cfg);
|
||||
|
||||
// lower frequencies - with keys
|
||||
goertzel.addFrequency(697, new DTMF(DTMF::Row, 0));
|
||||
goertzel.addFrequency(770, new DTMF(DTMF::Row, 1));
|
||||
goertzel.addFrequency(852, new DTMF(DTMF::Row, 2));
|
||||
goertzel.addFrequency(941, new DTMF(DTMF::Row, 3));
|
||||
// higher frequencies with idx
|
||||
goertzel.addFrequency(1209, new DTMF(DTMF::Col, 0));
|
||||
goertzel.addFrequency(1336, new DTMF(DTMF::Col, 1));
|
||||
goertzel.addFrequency(1477, new DTMF(DTMF::Col, 2));
|
||||
goertzel.addFrequency(1633, new DTMF(DTMF::Col, 3));
|
||||
// define callback
|
||||
goertzel.setFrequencyDetectionCallback(GoetzelCallback);
|
||||
|
||||
// start goertzel
|
||||
auto gcfg = goertzel.defaultConfig();
|
||||
gcfg.copyFrom(info);
|
||||
gcfg.threshold = 5.0;
|
||||
gcfg.block_size = 1024;
|
||||
goertzel.begin(gcfg);
|
||||
}
|
||||
|
||||
void loop() { copier.copy(); }
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file streams-audiokit-multioutput-server.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief MultiOutput Example using output to speaker and webserver
|
||||
* @version 0.1
|
||||
* @date 2022-07-26
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/Communication/AudioHttp.h"
|
||||
|
||||
const int buffer_count = 10;
|
||||
const int buffer_size = 1024;
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // input & output
|
||||
QueueStream<uint8_t> queue(buffer_size, buffer_count, true);
|
||||
AudioEncoderServer server(new WAVEncoder(),"WIFI","password");
|
||||
MultiOutput out(queue, kit);
|
||||
StreamCopy copier(out, kit); // copy kit to kit
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup audiokit
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = false;
|
||||
cfg.input_device = ADC_INPUT_LINE2; // input from microphone
|
||||
cfg.sample_rate = 16000;
|
||||
kit.setVolume(0.5);
|
||||
kit.begin(cfg);
|
||||
|
||||
// start queue
|
||||
queue.begin();
|
||||
|
||||
// start server
|
||||
server.begin(queue, cfg);
|
||||
Serial.println("started...");
|
||||
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
server.copy();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file streams-audiokit-multioutput.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief MultiOutput Example using add
|
||||
* @version 0.1
|
||||
* @date 2022-07-26
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(8000, 2, 16);
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||
CsvOutput<int16_t> csv(Serial);
|
||||
MultiOutput out;
|
||||
StreamCopy copier(out, kit); // copy kit to kit
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(230400);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
out.add(csv);
|
||||
out.add(kit);
|
||||
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.copyFrom(info);
|
||||
cfg.sd_active = false;
|
||||
cfg.input_device = ADC_INPUT_LINE2; // input from microphone
|
||||
kit.setVolume(0.5);
|
||||
kit.begin(cfg);
|
||||
|
||||
csv.begin(info);
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file streams-audiokit-sd-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief We record the input from the microphone to SPI RAM and constantly repeat to play the file
|
||||
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||
* @version 0.1
|
||||
* @date 2022-09-01
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioLibs/MemoryManager.h"
|
||||
|
||||
AudioInfo info(16000, 1, 16);
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
DynamicMemoryStream recording(true); // Audio stored on heap
|
||||
StreamCopy copier; // copies data
|
||||
|
||||
|
||||
void record_start(bool pinStatus, int pin, void* ref){
|
||||
Serial.println("Recording...");
|
||||
recording.begin();
|
||||
copier.begin(recording, kit);
|
||||
}
|
||||
|
||||
void record_end(bool pinStatus, int pin, void* ref){
|
||||
Serial.println("Playing...");
|
||||
|
||||
// Remove popping noise, from button: we delete 6 segments at the beginning and end
|
||||
// and on the resulting audio we slowly raise the volume on the first segment
|
||||
// end decrease it on the last segment
|
||||
recording.postProcessSmoothTransition<int16_t>(info.channels, 0.01, 6);
|
||||
|
||||
// Restart from beginning
|
||||
recording.rewind();
|
||||
|
||||
// output to kit
|
||||
copier.begin(kit, recording); // start playback
|
||||
}
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
while(!Serial); // wait for serial to be ready
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup input and output
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = true;
|
||||
cfg.copyFrom(info);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(1.0);
|
||||
|
||||
// record when key 1 is pressed
|
||||
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||
Serial.println("Press Key 1 to record");
|
||||
|
||||
}
|
||||
|
||||
void loop(){
|
||||
|
||||
// record or play recording
|
||||
copier.copy();
|
||||
|
||||
// Process keys
|
||||
kit.processActions();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file streams-audiokit-sd-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief We record the input from the microphone to SPI RAM and constantly repeat to play the file
|
||||
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||
* The output pitch is shifted by 1 octave!
|
||||
* @version 0.1
|
||||
* @date 2022-11-21
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioLibs/MemoryManager.h"
|
||||
|
||||
AudioInfo info(16000, 1, 16);
|
||||
MemoryManager memory(500); // Activate SPI RAM for objects > 500 bytes
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
//use one of VariableSpeedRingBufferSimple, VariableSpeedRingBuffer, VariableSpeedRingBuffer180
|
||||
PitchShiftOutput<int16_t, VariableSpeedRingBuffer<int16_t>> pitch_shift(kit);
|
||||
DynamicMemoryStream recording(false); // Audio stored on heap, non repeating
|
||||
StreamCopy copier; // copies data
|
||||
|
||||
|
||||
void record_start(bool pinStatus, int pin, void* ref){
|
||||
Serial.println("Recording...");
|
||||
recording.begin();
|
||||
copier.begin(recording, kit);
|
||||
}
|
||||
|
||||
void record_end(bool pinStatus, int pin, void* ref){
|
||||
Serial.println("Playing...");
|
||||
|
||||
// Remove popping noise, from button: we delete 6 segments at the beginning and end
|
||||
// and on the resulting audio we slowly raise the volume on the first segment
|
||||
// end decrease it on the last segment
|
||||
recording.postProcessSmoothTransition<int16_t>(info.channels, 0.01, 6);
|
||||
|
||||
// output with pitch shifting
|
||||
copier.begin(pitch_shift, recording); // start playback
|
||||
}
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
while(!Serial); // wait for serial to be ready
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup input and output
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = true;
|
||||
cfg.copyFrom(info);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(1.0);
|
||||
|
||||
// setup pitch shift
|
||||
auto cfg_pc = pitch_shift.defaultConfig();
|
||||
cfg_pc.pitch_shift = 2; // one octave up
|
||||
cfg_pc.buffer_size = 1000;
|
||||
cfg_pc.copyFrom(info);
|
||||
pitch_shift.begin(cfg_pc);
|
||||
|
||||
// record when key 1 is pressed
|
||||
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||
Serial.println("Press Key 1 to record");
|
||||
}
|
||||
|
||||
void loop(){
|
||||
// record or play recording
|
||||
copier.copy();
|
||||
|
||||
// Process keys
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @file streams-audiokit-sd-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief We record the input from the microphone to a file and constantly repeat to play the file
|
||||
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||
* @version 0.1
|
||||
* @date 2022-09-01
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
|
||||
const char *file_name = "/rec.raw";
|
||||
AudioInfo info(16000, 1, 16);
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
File file; // final output stream
|
||||
StreamCopy copier; // copies data
|
||||
bool recording = false; // flag to make sure that close is only executed one
|
||||
uint64_t end_time; // trigger to call endRecord
|
||||
|
||||
|
||||
void record_start(bool pinStatus, int pin, void* ref){
|
||||
Serial.println("Recording...");
|
||||
// open the output file
|
||||
file = SD.open(file_name, FILE_WRITE);
|
||||
copier.begin(file, kit);
|
||||
recording = true;
|
||||
}
|
||||
|
||||
void record_end(bool pinStatus, int pin, void* ref){
|
||||
if (recording == true){
|
||||
Serial.println("Playing...");
|
||||
file.close();
|
||||
recording = false;
|
||||
file = SD.open(file_name); // reopen in read mode
|
||||
copier.begin(kit, file); // start playback
|
||||
}
|
||||
}
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
while(!Serial); // wait for serial to be ready
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// setup input and output: setup audiokit before SD!
|
||||
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||
cfg.sd_active = true;
|
||||
cfg.copyFrom(info);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(1.0);
|
||||
|
||||
// Open SD drive
|
||||
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)) {
|
||||
Serial.println("Initialization failed!");
|
||||
while (1); // stop
|
||||
}
|
||||
Serial.println("Initialization done.");
|
||||
|
||||
|
||||
// record when key 1 is pressed
|
||||
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||
Serial.println("Press Key 1 to record");
|
||||
|
||||
}
|
||||
|
||||
void loop(){
|
||||
|
||||
// record or play file
|
||||
copier.copy();
|
||||
|
||||
// while playing: at end of file -> reposition to beginning
|
||||
if (!recording && file.size()>0 && file.available()==0){
|
||||
file.seek(0);
|
||||
Serial.println("Replay...");
|
||||
}
|
||||
|
||||
// Process keys
|
||||
kit.processActions();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @file streams-audiokit-sd_wav.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Demonstrates how to use an encoder to write to a file
|
||||
* @version 0.1
|
||||
* @date 2023-05-04
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#include <SD.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
const char* file_name = "/rec.wav";
|
||||
AudioInfo info(16000, 1, 16);
|
||||
AudioBoardStream in(AudioKitEs8388V1);
|
||||
File file; // final output stream
|
||||
EncodedAudioStream out(&file, new WAVEncoder());
|
||||
StreamCopy copier(out, in); // copies data
|
||||
uint64_t timeout;
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup input
|
||||
auto cfg = in.defaultConfig(RX_MODE);
|
||||
cfg.sd_active = true;
|
||||
cfg.copyFrom(info);
|
||||
cfg.input_device = ADC_INPUT_LINE2; // microphone
|
||||
in.begin(cfg);
|
||||
|
||||
// Open SD drive
|
||||
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)) {
|
||||
Serial.println("Initialization failed!");
|
||||
stop();
|
||||
}
|
||||
|
||||
// Cleanup if necessary
|
||||
if (SD.exists(file_name))
|
||||
SD.remove(file_name);
|
||||
|
||||
// open file
|
||||
file = SD.open(file_name, FILE_WRITE);
|
||||
if (!file){
|
||||
Serial.println("file failed!");
|
||||
stop();
|
||||
}
|
||||
|
||||
// setup output
|
||||
out.begin(info);
|
||||
|
||||
// set timeout - recoring for 5 seconds
|
||||
timeout = millis() + 5000;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (millis() < timeout) {
|
||||
// record to wav file
|
||||
copier.copy();
|
||||
} else {
|
||||
// close file when done
|
||||
if (file) {
|
||||
file.flush();
|
||||
Serial.print("File has ");
|
||||
Serial.print(file.size());
|
||||
Serial.println(" bytes");
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
# Stream Input from an AudioKit to CSV Output
|
||||
|
||||
## General Description:
|
||||
|
||||
We implement a AudioKit source: We stream the sound input which we read in from the I2S interface and display it on the Arduino Serial Plotter.
|
||||
|
||||
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file streams-audiokit-csv.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-serial/README.md
|
||||
*
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||
CsvOutput<int16_t> csvOutput(Serial);
|
||||
StreamCopy copier(csvOutput, kit); // copy kit to csvOutput
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
auto cfg = kit.defaultConfig(RX_MODE);
|
||||
cfg.copyFrom(info);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
kit.begin(cfg);
|
||||
|
||||
// make sure that we have the correct channels set up
|
||||
csvOutput.begin(info);
|
||||
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
## Using the AI Thinker ESP32 Audio Kit Micro Speech
|
||||
|
||||
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board.
|
||||
|
||||
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||
|
||||
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies
|
||||
|
||||
The staring point for doing speech recognition on an Arduino based board is TensorFlow Light For Microcontrollers with the example sketch called micro_speech!
|
||||
|
||||
I have adapted the MicroSpeech example from TensorFlow Lite to follow the philosophy of this framework. The example uses a Tensorflow model which can recognise the words 'yes' and 'no'. The output stream class is TfLiteAudioOutput. In the example I am using an ESP32 AudioKit board, but you can replace this with any type of processor with a microphone.
|
||||
Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/TensorFlow-Lite---MicroSpeech)
|
||||
|
||||
|
||||
### Note
|
||||
|
||||
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
- https://github.com/pschatzmann/tflite-micro-arduino-examples
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioLibs/TfLiteAudioStream.h"
|
||||
#include "model.h" // tensorflow model
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||
TfLiteAudioStream tfl; // Audio sink
|
||||
const char* kCategoryLabels[4] = {
|
||||
"silence",
|
||||
"unknown",
|
||||
"yes",
|
||||
"no",
|
||||
};
|
||||
StreamCopy copier(tfl, kit); // copy mic to tfl
|
||||
int channels = 1;
|
||||
int samples_per_second = 16000;
|
||||
|
||||
void respondToCommand(const char* found_command, uint8_t score,
|
||||
bool is_new_command) {
|
||||
if (is_new_command) {
|
||||
char buffer[80];
|
||||
sprintf(buffer, "Result: %s, score: %d, is_new: %s", found_command, score,
|
||||
is_new_command ? "true" : "false");
|
||||
Serial.println(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// setup Audiokit
|
||||
auto cfg = kit.defaultConfig(RX_MODE);
|
||||
cfg.input_device = ADC_INPUT_LINE2;
|
||||
cfg.channels = channels;
|
||||
cfg.sample_rate = samples_per_second;
|
||||
cfg.use_apll = false;
|
||||
//cfg.auto_clear = true;
|
||||
cfg.buffer_size = 512;
|
||||
cfg.buffer_count = 16;
|
||||
kit.begin(cfg);
|
||||
|
||||
// Setup tensorflow
|
||||
auto tcfg = tfl.defaultConfig();
|
||||
tcfg.setCategories(kCategoryLabels);
|
||||
tcfg.channels = channels;
|
||||
tcfg.sample_rate = samples_per_second;
|
||||
tcfg.kTensorArenaSize = 10 * 1024;
|
||||
tcfg.respondToCommand = respondToCommand;
|
||||
tcfg.model = g_model;
|
||||
tfl.begin(tcfg);
|
||||
}
|
||||
|
||||
void loop() { copier.copy(); }
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file streams-file_loop-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Just a small demo, how to use looping (=repeating) files with the SD library
|
||||
* @version 0.1
|
||||
* @date 2022-10-09
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/Disk/FileLoop.h"
|
||||
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||
|
||||
|
||||
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||
EncodedAudioStream decoder(&i2s, new MP3DecoderHelix()); // Decoding stream
|
||||
FileLoop loopingFile;
|
||||
StreamCopy copier(decoder, loopingFile);
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup audiokit before SD!
|
||||
auto config = i2s.defaultConfig(TX_MODE);
|
||||
config.sd_active = true;
|
||||
i2s.begin(config);
|
||||
|
||||
// setup file
|
||||
SD.begin(chipSelect);
|
||||
loopingFile.setFile(SD.open("/ZZ Top/Unknown Album/Lowrider.mp3"));
|
||||
//loopingFile.setLoopCount(-1); // define loop count
|
||||
//audioFile.setStartPos(44); // restart from pos 44
|
||||
//if ((audioFile.size()-44) % 1024!=0) audioFile.setSize((((audioFile.size()-44)/1024)+1)*1024+44);
|
||||
loopingFile.begin();
|
||||
|
||||
// setup I2S based on sampling rate provided by decoder
|
||||
decoder.begin();
|
||||
}
|
||||
|
||||
void loop(){
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file streams-generator-audiokit.ino
|
||||
* @brief Tesing I2S output on audiokit
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(32000, 2, 16);
|
||||
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
StreamCopy copier(out, sound); // copies sound into i2s
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(TX_MODE);
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// Setup sine wave
|
||||
sineWave.begin(info, N_B4);
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file streams-generator_fromarray-audiokit.ino
|
||||
* @brief Tesing GeneratorFromArray with output on audiokit
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
int16_t sine_array[] = {0, 2285, 4560, 6812, 9031, 11206, 13327, 15383, 17363, 19259, 21062, 22761, 24350, 25820, 27165, 28377, 29450, 30381, 31163, 31793, 32269, 32587, 32747, 32747, 32587, 32269, 31793, 31163, 30381, 29450, 28377, 27165, 25820, 24350, 22761, 21062, 19259, 17363, 15383, 13327, 11206, 9031, 6812, 4560, 2285, 0, -2285, -4560, -6812, -9031, -11206, -13327, -15383, -17363, -19259, -21062, -22761, -24350, -25820, -27165, -28377, -29450, -30381, -31163, -31793, -32269, -32587, -32747, -32747, -32587, -32269, -31793, -31163, -30381, -29450, -28377, -27165, -25820, -24350, -22761, -21062, -19259, -17363, -15383, -13327, -11206, -9031, -6812, -4560, -2285 };
|
||||
GeneratorFromArray<int16_t> sineWave(sine_array,0,false);
|
||||
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
|
||||
StreamCopy copier(out, sound); // copies sound into i2s
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(TX_MODE);
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// Setup sine wave
|
||||
sineWave.begin(info);
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file streams-generator_inputmixer-audiokit.ino
|
||||
* @brief Tesing input mixer
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(32000, 2, 16);
|
||||
SineWaveGenerator<int16_t> sineWave1(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
SineWaveGenerator<int16_t> sineWave2(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
GeneratedSoundStream<int16_t> sound1(sineWave1); // Stream generated from sine wave
|
||||
GeneratedSoundStream<int16_t> sound2(sineWave2); // Stream generated from sine wave
|
||||
InputMixer<int16_t> mixer;
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
StreamCopy copier(out, mixer); // copies sound into i2s
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(TX_MODE);
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// Setup sine wave
|
||||
sineWave1.begin(info, N_B4);
|
||||
sineWave2.begin(info, N_E4);
|
||||
|
||||
mixer.add(sound1);
|
||||
mixer.add(sound2);
|
||||
mixer.begin(info);
|
||||
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file streams-generator_outputmixer-audiokit.ino
|
||||
* @brief Tesing output mixer
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
const int N = 5;
|
||||
SineWaveGenerator<int16_t> sineWave[N](32000);
|
||||
GeneratedSoundStream<int16_t> sound[N];
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
OutputMixer<int16_t> mixer(out, N, DefaultAllocatorRAM);
|
||||
StreamCopy copier[N](DefaultAllocatorRAM);
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
for (int j = 0; j < N; j++) {
|
||||
sineWave[j].begin(info, 440 * (j + 1));
|
||||
sound[j].setInput(sineWave[j]);
|
||||
sound[j].begin(info);
|
||||
copier[j].begin(mixer, sound[j]);
|
||||
}
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(TX_MODE);
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// setup Output mixer with default buffer size
|
||||
mixer.begin();
|
||||
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
// write each output
|
||||
for (int j = 0; j < N; j++) {
|
||||
copier[j].copy();
|
||||
}
|
||||
|
||||
// We could flush to force the output but this is not necessary because we
|
||||
// were already writing all streams
|
||||
// mixer.flushMixer();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file streams-generator_sinfromtable-audiokit.ino
|
||||
* @brief Tesing SineFromTable with output on audiokit
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(32000, 2, 16);
|
||||
SineFromTable<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
//CsvOutput<int16_t> out(Serial);
|
||||
int sound_len=1024;
|
||||
StreamCopy copier(out, sound, sound_len); // copies sound into i2s
|
||||
int freq = 122;
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(); //TX_MODE
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// Setup sine wave
|
||||
sineWave.begin(info, freq);
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
// the length is defined by sound_len
|
||||
copier.copy();
|
||||
// increase frequency
|
||||
freq += 10;
|
||||
if (freq>=10000){
|
||||
freq = 20;
|
||||
}
|
||||
sineWave.setFrequency(freq);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file streams-memory_mp3_short-i2s.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief decode MP3 stream and output as i2s signal
|
||||
* @version 0.1
|
||||
* @date 2021-01-24
|
||||
*
|
||||
* @copyright Copyright (c) 2021
|
||||
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "zero.h"
|
||||
|
||||
MemoryStream mp3(zero_mp3, zero_mp3_len);
|
||||
AudioBoardStream i2s(AudioKitEs8388V1);
|
||||
MP3DecoderHelix helix;
|
||||
EncodedAudioStream out(&i2s, &helix); // output to decoder
|
||||
StreamCopy copier(out, mp3); // copy in to i2s
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// begin processing
|
||||
auto cfg = i2s.defaultConfig();
|
||||
cfg.sample_rate = 24000;
|
||||
cfg.channels = 1;
|
||||
i2s.begin(cfg);
|
||||
out.begin();
|
||||
}
|
||||
|
||||
void loop(){
|
||||
if (mp3.available()) {
|
||||
copier.copy();
|
||||
} else {
|
||||
helix.end(); // flush output
|
||||
auto info = out.decoder().audioInfo();
|
||||
LOGI("The audio rate from the mp3 file is %d", info.sample_rate);
|
||||
LOGI("The channels from the mp3 file is %d", info.channels);
|
||||
i2s.end();
|
||||
stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
#pragma once
|
||||
|
||||
const unsigned char zero_mp3[] = {
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x00, 0x11, 0x20, 0x6a, 0x1c, 0x00, 0x7b, 0x0c,
|
||||
0x28, 0x52, 0x24, 0x4c, 0x22, 0xb4, 0xe2, 0x18, 0x80, 0x0e, 0x52, 0x2f,
|
||||
0xa0, 0x17, 0x07, 0xc5, 0x62, 0x21, 0xd8, 0x83, 0x56, 0x4c, 0xc3, 0x52,
|
||||
0x51, 0x38, 0x3c, 0xdb, 0x82, 0x33, 0xf8, 0x9c, 0xb9, 0x47, 0x1c, 0x20,
|
||||
0x8b, 0x2b, 0x79, 0xcf, 0x97, 0x1e, 0xf0, 0x83, 0xb2, 0x8a, 0xa5, 0x1f,
|
||||
0xff, 0xfe, 0xc4, 0x27, 0xc4, 0x00, 0x83, 0xb9, 0x75, 0xa8, 0x10, 0x0c,
|
||||
0x10, 0x28, 0x5c, 0x78, 0x5c, 0x2e, 0x0e, 0x02, 0x01, 0x85, 0x83, 0x18,
|
||||
0x82, 0xec, 0x5c, 0x86, 0x25, 0x21, 0x6a, 0x00, 0xe4, 0x4b, 0xcd, 0x35,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x0e, 0x11, 0x98, 0xca, 0x80, 0x00, 0xc3, 0xc6,
|
||||
0x70, 0x11, 0x90, 0xd0, 0x41, 0xfa, 0x58, 0xd8, 0x1e, 0x45, 0x57, 0xc4,
|
||||
0xd4, 0x3d, 0xe1, 0xe5, 0x35, 0x7a, 0x6b, 0xfc, 0x6a, 0x9f, 0xbe, 0x95,
|
||||
0xdd, 0xe3, 0xee, 0xe0, 0x60, 0x41, 0x38, 0x20, 0x27, 0xa9, 0xc4, 0xd4,
|
||||
0x08, 0x09, 0xc4, 0xeb, 0x3f, 0xff, 0xd4, 0x18, 0x13, 0xc9, 0xed, 0xff,
|
||||
0xff, 0xff, 0x59, 0xfa, 0xa5, 0xfe, 0x73, 0x07, 0xc3, 0xea, 0x86, 0x70,
|
||||
0xa7, 0x72, 0xa0, 0xc0, 0x2c, 0x54, 0x47, 0x5f, 0xd2, 0x3a, 0x52, 0xea,
|
||||
0x18, 0x93, 0xb1, 0x97, 0xee, 0xcd, 0xba, 0x78, 0x00, 0x1c, 0x7a, 0xb1,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x1a, 0x17, 0x62, 0xea, 0x94, 0x00, 0xd1, 0x44,
|
||||
0xb9, 0x45, 0x9e, 0x5f, 0xda, 0xd2, 0x92, 0xb6, 0xa4, 0x58, 0x81, 0xa2,
|
||||
0x82, 0x42, 0x8c, 0x2c, 0xca, 0xea, 0xf2, 0x2d, 0x5e, 0xe9, 0x73, 0x91,
|
||||
0xb3, 0xff, 0xd2, 0xb6, 0xe8, 0xaf, 0xe8, 0x22, 0x88, 0x9e, 0x8d, 0x92,
|
||||
0xfd, 0xe8, 0xcb, 0xfd, 0xbb, 0x1d, 0xda, 0xf3, 0xab, 0x93, 0x6e, 0xcf,
|
||||
0xa9, 0xc8, 0xd5, 0x33, 0x9d, 0xd1, 0x9d, 0x64, 0x20, 0x37, 0x41, 0x0d,
|
||||
0x75, 0x0e, 0x06, 0xe0, 0x9d, 0xc2, 0x23, 0xf7, 0xda, 0xa6, 0xbd, 0xf6,
|
||||
0x23, 0x80, 0x45, 0x8d, 0x19, 0xf4, 0x9c, 0xe3, 0xb4, 0x84, 0x98, 0x6a,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x0f, 0x16, 0x3b, 0x1a, 0xa4, 0x00, 0xc1, 0x4a,
|
||||
0xbd, 0x59, 0x63, 0x3a, 0xd4, 0xe0, 0xcc, 0x9a, 0xb7, 0x6f, 0xd6, 0xdf,
|
||||
0xce, 0x86, 0x2d, 0x8d, 0xf6, 0xfd, 0x29, 0xea, 0x95, 0x7f, 0xff, 0x4a,
|
||||
0x67, 0xfa, 0x7f, 0xdd, 0x7d, 0x74, 0xcd, 0xdf, 0x7c, 0x8e, 0xcf, 0xb1,
|
||||
0x1d, 0x6d, 0x98, 0x85, 0x54, 0x7a, 0x3b, 0x9f, 0x41, 0x8c, 0xe4, 0x55,
|
||||
0x33, 0x0d, 0x1c, 0xe4, 0x14, 0x17, 0x45, 0x40, 0xfb, 0x9c, 0x38, 0x38,
|
||||
0x44, 0x79, 0x1c, 0x39, 0x28, 0x38, 0x9b, 0x04, 0xce, 0x01, 0x98, 0x3e,
|
||||
0x20, 0x1c, 0x11, 0x9f, 0x71, 0x54, 0x82, 0x0a, 0xc2, 0x5d, 0x96, 0x26,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x09, 0x14, 0x63, 0x22, 0xa8, 0x00, 0x78, 0x4e,
|
||||
0xbc, 0x99, 0xeb, 0x85, 0x6b, 0xf1, 0x6e, 0x4b, 0xff, 0xaf, 0xff, 0xcd,
|
||||
0x13, 0xf6, 0xbf, 0x2b, 0xfa, 0xfc, 0xba, 0xbf, 0x7f, 0xb6, 0xbf, 0x45,
|
||||
0xa7, 0xbe, 0xfa, 0xe7, 0x53, 0xeb, 0x31, 0xb5, 0xa1, 0x8a, 0xb9, 0x95,
|
||||
0x44, 0x9f, 0x53, 0x19, 0xdc, 0xd9, 0xa5, 0x56, 0x61, 0xf4, 0x66, 0xa9,
|
||||
0x76, 0x1c, 0xa9, 0xa6, 0x98, 0x92, 0x6c, 0x5c, 0x78, 0xf2, 0x43, 0xe3,
|
||||
0xae, 0xa7, 0x16, 0x1c, 0x2e, 0x4c, 0xb8, 0x8c, 0x38, 0x70, 0x46, 0x54,
|
||||
0xb9, 0x75, 0xa6, 0x9b, 0xe6, 0x1c, 0x46, 0x91, 0x30, 0x6b, 0x89, 0xef,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x0a, 0x14, 0xfb, 0x22, 0xa4, 0x00, 0x78, 0x4a,
|
||||
0xbc, 0x4b, 0x7f, 0xbf, 0x9f, 0xf9, 0xaf, 0xff, 0xff, 0xc8, 0x8c, 0xf0,
|
||||
0x65, 0xd5, 0xf6, 0xc8, 0xbf, 0x57, 0xbd, 0x5e, 0xb6, 0xcf, 0xfa, 0xf3,
|
||||
0x76, 0x6f, 0xc8, 0xee, 0x8f, 0xad, 0x59, 0xfe, 0x87, 0x91, 0x5c, 0xee,
|
||||
0xa8, 0xa6, 0x32, 0x14, 0x91, 0x85, 0xa0, 0xa2, 0x65, 0x67, 0x22, 0x5d,
|
||||
0x48, 0x64, 0x62, 0x89, 0x87, 0xca, 0x34, 0x83, 0x06, 0x07, 0x43, 0x82,
|
||||
0x63, 0xc7, 0x09, 0x8b, 0x1d, 0x86, 0x80, 0xe3, 0x82, 0xd4, 0xa8, 0x42,
|
||||
0x00, 0xe2, 0xec, 0x2d, 0x44, 0x22, 0x10, 0x89, 0x03, 0x0a, 0x38, 0xab,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x09, 0x14, 0xcb, 0x1e, 0xa8, 0x00, 0x38, 0x50,
|
||||
0xbc, 0x6f, 0xff, 0xff, 0xff, 0xfe, 0xdc, 0xa2, 0x07, 0x4e, 0x82, 0x6e,
|
||||
0x68, 0x98, 0xcf, 0x4f, 0xee, 0xbf, 0xf8, 0xfe, 0xa7, 0xfa, 0xbd, 0x3b,
|
||||
0x4b, 0xef, 0xfe, 0x3f, 0xff, 0xa9, 0x5e, 0x9b, 0xee, 0x5e, 0x23, 0xae,
|
||||
0xe6, 0xdd, 0xe2, 0x21, 0x9a, 0x51, 0xd2, 0x5e, 0xee, 0x10, 0xb2, 0xee,
|
||||
0xfb, 0x52, 0x39, 0x20, 0x93, 0x11, 0xec, 0x54, 0x98, 0x10, 0x58, 0xed,
|
||||
0x49, 0xab, 0xa6, 0x30, 0xac, 0xf2, 0x06, 0x0b, 0x1c, 0x27, 0x41, 0x10,
|
||||
0x21, 0xa3, 0xc6, 0xd5, 0x5d, 0x10, 0x1c, 0x14, 0x3c, 0xcb, 0xd3, 0xe6,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x08, 0x13, 0x8b, 0x22, 0xb0, 0x00, 0x40, 0x4a,
|
||||
0xbc, 0xff, 0xff, 0xe5, 0xf2, 0xff, 0xff, 0x54, 0x66, 0x4e, 0xdf, 0x59,
|
||||
0xd6, 0x02, 0xcb, 0x32, 0x22, 0xff, 0xef, 0xbf, 0xb6, 0x8c, 0x9b, 0xd2,
|
||||
0x8d, 0x44, 0x6c, 0x8c, 0xcd, 0xbc, 0x94, 0xb2, 0xa7, 0x64, 0x89, 0x4a,
|
||||
0xe3, 0x19, 0x95, 0xa6, 0x79, 0xca, 0x2e, 0x47, 0x55, 0x2d, 0xd4, 0xf1,
|
||||
0xe2, 0x51, 0x67, 0x17, 0xb2, 0x91, 0x8a, 0x2e, 0x16, 0x0c, 0x71, 0x61,
|
||||
0x53, 0x9c, 0x38, 0xcc, 0x2e, 0xa2, 0x01, 0xc1, 0x10, 0xe0, 0xa3, 0xaa,
|
||||
0xd7, 0xf6, 0xee, 0xa9, 0x8c, 0x8c, 0x51, 0x08, 0x7e, 0x57, 0x62, 0x26,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x0c, 0x13, 0xc3, 0x0e, 0xb8, 0x00, 0xc0, 0x84,
|
||||
0xb9, 0xdc, 0xd7, 0x5d, 0x1f, 0xff, 0x14, 0x39, 0xfd, 0x4f, 0xff, 0xc8,
|
||||
0x4f, 0xaa, 0xec, 0xc6, 0x2a, 0xb0, 0x4d, 0x92, 0xba, 0x12, 0x8e, 0x62,
|
||||
0x33, 0xb3, 0x5d, 0xdd, 0x57, 0xd1, 0x2b, 0xff, 0xf4, 0x4d, 0xea, 0xa9,
|
||||
0xff, 0xba, 0x74, 0xfc, 0xed, 0xd9, 0xa9, 0x4d, 0x26, 0x7d, 0x51, 0x76,
|
||||
0xb1, 0xca, 0xe9, 0x4b, 0x83, 0x50, 0x45, 0x80, 0xb3, 0x21, 0x90, 0xea,
|
||||
0xcf, 0xa1, 0x5b, 0x31, 0x8a, 0x15, 0x32, 0x09, 0xb1, 0xfc, 0xe6, 0x53,
|
||||
0x27, 0x48, 0x65, 0x60, 0x4f, 0xda, 0x97, 0x4e, 0x15, 0x53, 0x1f, 0xaa,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x10, 0x15, 0x39, 0xba, 0xac, 0x00, 0xc9, 0xda,
|
||||
0x94, 0x14, 0xcb, 0x80, 0xc1, 0x9f, 0x34, 0x69, 0xe8, 0x51, 0xfc, 0xe1,
|
||||
0x3b, 0xf4, 0x10, 0x9c, 0x6b, 0x52, 0x71, 0x0e, 0xb4, 0x8d, 0x93, 0x40,
|
||||
0x97, 0x06, 0xd9, 0x71, 0x05, 0x58, 0x4f, 0xcb, 0x88, 0x3a, 0x2e, 0x49,
|
||||
0x09, 0x73, 0x1f, 0x42, 0x99, 0x82, 0xfd, 0x34, 0xfd, 0x54, 0x3d, 0x33,
|
||||
0x7f, 0x44, 0xc5, 0x4b, 0xa4, 0x6c, 0x07, 0x67, 0xff, 0xff, 0x53, 0xc6,
|
||||
0x9d, 0x59, 0xaa, 0xd7, 0xcf, 0x48, 0x05, 0x65, 0xec, 0x1b, 0xe7, 0x72,
|
||||
0xff, 0x8e, 0x02, 0xc9, 0xa5, 0xd7, 0x2d, 0x4a, 0x41, 0x3a, 0xa0, 0x77,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x0e, 0x12, 0x99, 0xc2, 0xb4, 0x00, 0xc9, 0xd6,
|
||||
0x94, 0xf5, 0x09, 0x9f, 0xcf, 0x23, 0xf7, 0xf4, 0x1a, 0x12, 0xf5, 0x16,
|
||||
0xff, 0x0d, 0x36, 0xbf, 0x61, 0x40, 0x30, 0x3f, 0x27, 0x30, 0x7c, 0x12,
|
||||
0xce, 0xcf, 0x29, 0x8d, 0xe1, 0xf8, 0xeb, 0x6d, 0x83, 0x61, 0x08, 0x3f,
|
||||
0x44, 0xd4, 0xdd, 0x7f, 0xb2, 0xdb, 0xfb, 0xf3, 0xbf, 0x37, 0x27, 0xcd,
|
||||
0x5b, 0xbf, 0x41, 0x1a, 0xa9, 0x7f, 0xff, 0xfe, 0xaa, 0x3b, 0x17, 0x77,
|
||||
0xfd, 0x4a, 0xe6, 0xbf, 0x55, 0x60, 0x21, 0xb5, 0xcb, 0xbf, 0x2b, 0x30,
|
||||
0x31, 0xb3, 0xe5, 0x63, 0x9d, 0x76, 0x8d, 0x1f, 0xf1, 0x5f, 0x93, 0xc8,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x16, 0x10, 0x51, 0xba, 0xb8, 0x00, 0xc1, 0x50,
|
||||
0x94, 0x10, 0x7e, 0xa2, 0x62, 0x4d, 0xe5, 0x94, 0xdf, 0x96, 0x2c, 0x0b,
|
||||
0x47, 0x59, 0x82, 0x80, 0x08, 0x02, 0x42, 0xd7, 0x14, 0x30, 0x45, 0x7d,
|
||||
0x11, 0xc0, 0x60, 0x9e, 0xfb, 0x22, 0xcd, 0xfe, 0x3b, 0x5f, 0xe9, 0xcd,
|
||||
0xae, 0x52, 0x59, 0xb7, 0x17, 0xb3, 0x09, 0xaa, 0xaa, 0xe7, 0xff, 0xf1,
|
||||
0x1d, 0xc4, 0x8e, 0xaf, 0x96, 0x56, 0x42, 0xe5, 0x9f, 0x2f, 0x2c, 0xeb,
|
||||
0x2f, 0x21, 0x9f, 0xce, 0xdc, 0xe7, 0x6e, 0x41, 0x45, 0xf0, 0x7e, 0x75,
|
||||
0xf3, 0xfe, 0xa3, 0x62, 0x98, 0xed, 0x06, 0x01, 0x01, 0x59, 0xed, 0xa4,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x27, 0x10, 0x49, 0xaa, 0xb8, 0x00, 0xc8, 0x92,
|
||||
0x95, 0x04, 0x05, 0xcc, 0xd6, 0xa3, 0x24, 0x2e, 0x25, 0xcd, 0x5e, 0x69,
|
||||
0x6d, 0xfb, 0xda, 0x97, 0xf5, 0xf2, 0x5b, 0xfd, 0xea, 0xbf, 0x7d, 0xeb,
|
||||
0x3a, 0x6e, 0xc4, 0xd5, 0xe7, 0xf7, 0x94, 0xe3, 0x81, 0xd1, 0x8e, 0x93,
|
||||
0x74, 0xaf, 0xd9, 0x04, 0x56, 0xca, 0xf2, 0xcf, 0x30, 0x8e, 0x01, 0xef,
|
||||
0xca, 0x88, 0xde, 0x3e, 0x51, 0xfb, 0x0b, 0x8d, 0xb9, 0x84, 0x09, 0x3e,
|
||||
0x60, 0xe9, 0x2b, 0x4d, 0xc2, 0x4b, 0x5a, 0x17, 0x01, 0xe0, 0x06, 0x0e,
|
||||
0x4c, 0x48, 0x2c, 0x2c, 0x69, 0x8a, 0x58, 0x8c, 0x10, 0xc5, 0x6e, 0x79,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x38, 0x12, 0x91, 0x9a, 0xb4, 0x00, 0xd1, 0xd0,
|
||||
0x95, 0x97, 0xd2, 0x5d, 0x7e, 0x93, 0x1d, 0x42, 0x4c, 0x5d, 0xc9, 0x6a,
|
||||
0xc7, 0x04, 0x46, 0x05, 0x28, 0xaf, 0xfe, 0xd5, 0xc3, 0x9f, 0xb8, 0xe0,
|
||||
0x31, 0xcd, 0xf4, 0xb2, 0xcc, 0x64, 0x47, 0x13, 0x9e, 0x0c, 0x77, 0x0b,
|
||||
0xa4, 0xc7, 0x3b, 0x96, 0x6f, 0x86, 0x03, 0xa6, 0xba, 0xf8, 0x7e, 0xe3,
|
||||
0x5f, 0xf2, 0xa3, 0x5e, 0xe6, 0x99, 0x34, 0xbc, 0xd7, 0x15, 0x9a, 0x95,
|
||||
0x20, 0x10, 0x10, 0xb2, 0xe7, 0x2e, 0x03, 0x90, 0x34, 0x9f, 0x99, 0xa1,
|
||||
0x4a, 0xd5, 0x63, 0x02, 0x12, 0x54, 0x31, 0xdb, 0x73, 0xe7, 0xb7, 0xa9,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x40, 0x11, 0xd9, 0x2a, 0xb4, 0x00, 0xc3, 0xd2,
|
||||
0x70, 0x74, 0x95, 0x36, 0x48, 0x58, 0xb1, 0xe2, 0x4a, 0xb3, 0xac, 0x2e,
|
||||
0xc9, 0xc0, 0x22, 0xdc, 0x93, 0x4b, 0x21, 0xf0, 0x45, 0x2b, 0x16, 0x4d,
|
||||
0x1e, 0x58, 0x00, 0xe4, 0x24, 0x75, 0x8b, 0xf4, 0x8e, 0xc4, 0x35, 0x2c,
|
||||
0xdf, 0xd7, 0x8d, 0x52, 0x59, 0xef, 0xd3, 0xd2, 0xf8, 0x45, 0x51, 0xa3,
|
||||
0xf2, 0xc9, 0xb2, 0x8b, 0x20, 0xa9, 0x12, 0x68, 0x15, 0x2e, 0x90, 0x0e,
|
||||
0x26, 0x6b, 0xa3, 0xb1, 0x52, 0xda, 0xa1, 0xf1, 0x0a, 0x12, 0x59, 0x24,
|
||||
0x42, 0xe3, 0xa3, 0x02, 0x8f, 0xfa, 0xfa, 0x95, 0x45, 0xef, 0x32, 0xf4,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x4b, 0x11, 0xe9, 0x1e, 0xb0, 0x00, 0xce, 0x12,
|
||||
0x70, 0x97, 0x43, 0x6a, 0x7b, 0xd9, 0x32, 0x80, 0xf2, 0xcd, 0xce, 0xc4,
|
||||
0x50, 0x16, 0x03, 0x7a, 0x5c, 0xce, 0xed, 0xdb, 0x6d, 0xa5, 0xb6, 0x72,
|
||||
0xa9, 0x1f, 0xb1, 0x8e, 0xe5, 0x72, 0xf9, 0xde, 0xd2, 0x04, 0xc5, 0x2c,
|
||||
0xed, 0x93, 0xa4, 0x69, 0x40, 0x40, 0x26, 0x48, 0x2a, 0x80, 0xa0, 0x48,
|
||||
0x46, 0x66, 0x64, 0x88, 0x5e, 0x4a, 0x99, 0xb5, 0x99, 0x22, 0xd6, 0xd6,
|
||||
0x65, 0xf1, 0x01, 0x9e, 0x1f, 0xfd, 0x8e, 0x39, 0x4a, 0xfe, 0xe1, 0x4e,
|
||||
0x31, 0x55, 0x27, 0x45, 0x2a, 0x80, 0x8d, 0x63, 0x28, 0x4b, 0xfd, 0x13,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x56, 0x11, 0xa9, 0x16, 0xb4, 0x00, 0xc6, 0x12,
|
||||
0x70, 0x43, 0x81, 0xe9, 0x50, 0xf2, 0xce, 0x4e, 0xa1, 0x84, 0x60, 0x95,
|
||||
0xde, 0xdb, 0xee, 0xa5, 0xd2, 0xec, 0x6e, 0xbc, 0x6e, 0xd5, 0xfc, 0x72,
|
||||
0x56, 0x1c, 0x51, 0xa5, 0x90, 0xb0, 0x12, 0x68, 0xd0, 0x49, 0x18, 0x4f,
|
||||
0x0f, 0xd8, 0x6f, 0x1c, 0x89, 0xf9, 0x61, 0xd5, 0x98, 0x10, 0x38, 0xb5,
|
||||
0xf2, 0x70, 0xbd, 0x7b, 0xaa, 0x32, 0xbd, 0x8b, 0xaf, 0x18, 0x3a, 0xb2,
|
||||
0x36, 0x7b, 0xe5, 0xbf, 0xff, 0xff, 0xff, 0xeb, 0x4f, 0xff, 0xa1, 0x15,
|
||||
0xc3, 0xb5, 0x60, 0x23, 0x19, 0x04, 0x4a, 0xa5, 0xac, 0xe9, 0x80, 0xe5,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x62, 0x15, 0x59, 0x16, 0xa4, 0x00, 0xc6, 0x5e,
|
||||
0x70, 0x87, 0x6c, 0xcf, 0x81, 0x38, 0x34, 0xc1, 0x70, 0xad, 0xf1, 0x47,
|
||||
0xaf, 0x5a, 0xce, 0x20, 0xc1, 0x67, 0xec, 0xfc, 0x61, 0x8a, 0xd5, 0xab,
|
||||
0x40, 0xd6, 0x0c, 0x68, 0xd9, 0x5d, 0x83, 0xd1, 0x5c, 0xfb, 0xa2, 0xc6,
|
||||
0x6a, 0xfb, 0x43, 0xf4, 0x5a, 0xf4, 0x7d, 0x4a, 0x9e, 0x7b, 0x25, 0x9f,
|
||||
0x2e, 0xd9, 0x46, 0x8b, 0x1e, 0x59, 0x1f, 0xf6, 0xae, 0xcf, 0xff, 0xff,
|
||||
0xff, 0xfa, 0xbf, 0xfd, 0x6a, 0xca, 0xd6, 0x51, 0x10, 0x3b, 0x52, 0xcb,
|
||||
0xf1, 0x40, 0xbd, 0xab, 0xfa, 0x35, 0x2b, 0x49, 0x53, 0x73, 0x40, 0x14,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x5f, 0x12, 0xd8, 0xea, 0xa0, 0x00, 0xce, 0x5e,
|
||||
0x70, 0x59, 0xbf, 0x9c, 0xa7, 0x62, 0x31, 0x4c, 0xf1, 0x4e, 0xe8, 0x7b,
|
||||
0x2b, 0x0e, 0x9b, 0x93, 0x45, 0x5f, 0xa4, 0x00, 0xa7, 0xa2, 0x52, 0x69,
|
||||
0x48, 0x2a, 0x2b, 0x56, 0x04, 0xbb, 0x36, 0xe4, 0xd8, 0xe7, 0x67, 0x75,
|
||||
0x7b, 0x39, 0x5b, 0xfb, 0x4b, 0xcd, 0x6a, 0x98, 0xf3, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x8d, 0xef, 0x6d, 0x10, 0xeb, 0x05,
|
||||
0x7e, 0x74, 0xfb, 0x8e, 0xd7, 0x4c, 0x48, 0xb3, 0x67, 0x10, 0x0a, 0x1c,
|
||||
0x90, 0xb8, 0xd0, 0x0c, 0xbe, 0xf3, 0x38, 0x96, 0xd3, 0x54, 0x5f, 0x08,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x66, 0x12, 0x00, 0xe2, 0x98, 0x00, 0xce, 0xb0,
|
||||
0x70, 0xd3, 0x8f, 0xc1, 0x49, 0xab, 0x62, 0x9a, 0x61, 0x6d, 0x0d, 0x10,
|
||||
0xc3, 0xaf, 0x23, 0xf0, 0x14, 0x15, 0x8b, 0x31, 0xb6, 0x97, 0xf8, 0xde,
|
||||
0x8f, 0xca, 0xb3, 0xce, 0x9a, 0x19, 0xb7, 0xf7, 0x71, 0xbf, 0xc2, 0x8e,
|
||||
0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0xbf, 0xfe, 0x9a, 0xc3, 0x7d,
|
||||
0x80, 0x87, 0xef, 0xca, 0xc2, 0xf3, 0x1c, 0x44, 0x6a, 0x0d, 0x2d, 0x30,
|
||||
0x4b, 0x47, 0xa9, 0xee, 0x73, 0xec, 0xa9, 0x16, 0x93, 0x6f, 0x2a, 0x96,
|
||||
0xad, 0x79, 0x9c, 0xaf, 0xac, 0x03, 0xb5, 0x95, 0x78, 0xe2, 0xf9, 0x6c,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x71, 0x12, 0xa0, 0xde, 0x90, 0x00, 0xd6, 0xf0,
|
||||
0x70, 0xd1, 0xaa, 0x91, 0xe1, 0x62, 0xe6, 0xec, 0x3d, 0x90, 0x65, 0x14,
|
||||
0xcc, 0x6e, 0x0d, 0x9f, 0x95, 0xca, 0xef, 0xbc, 0xf7, 0x2f, 0x61, 0x1c,
|
||||
0xbc, 0xe0, 0x62, 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x3e,
|
||||
0x8a, 0xb3, 0xdd, 0x37, 0x13, 0x88, 0x08, 0x77, 0x74, 0x06, 0x30, 0x4b,
|
||||
0x56, 0x1e, 0x70, 0x45, 0x69, 0x4e, 0x1b, 0xb1, 0x48, 0x6c, 0x1d, 0x5b,
|
||||
0xf7, 0x4d, 0x01, 0xb0, 0x29, 0x16, 0xa4, 0xad, 0x3a, 0x1d, 0xca, 0x48,
|
||||
0xca, 0x1b, 0x6b, 0x3c, 0x2f, 0x87, 0x69, 0xe2, 0xca, 0x55, 0x89, 0x98,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x79, 0x12, 0x60, 0xda, 0x9c, 0x00, 0xce, 0x70,
|
||||
0x70, 0x6a, 0x55, 0x94, 0x27, 0xe5, 0xea, 0x3b, 0x79, 0xcf, 0x11, 0xf4,
|
||||
0xaa, 0x74, 0xf4, 0x77, 0xaa, 0x43, 0xa2, 0x7a, 0xe2, 0x04, 0x5c, 0xde,
|
||||
0x98, 0xfe, 0x01, 0x85, 0x3e, 0xfb, 0xec, 0xff, 0xff, 0xff, 0xff, 0xef,
|
||||
0x5a, 0x7f, 0xf6, 0xb3, 0xa5, 0x15, 0xee, 0xab, 0x90, 0x00, 0x06, 0x19,
|
||||
0x05, 0xd9, 0x81, 0x29, 0xd2, 0x56, 0x8b, 0x11, 0x62, 0x45, 0x72, 0x5c,
|
||||
0x8a, 0x82, 0x5a, 0x8f, 0xfa, 0x47, 0x94, 0x56, 0xae, 0x56, 0xd3, 0xc6,
|
||||
0x73, 0xe5, 0x29, 0xc5, 0x47, 0xba, 0x56, 0x9d, 0x96, 0xe5, 0x4d, 0x26,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x82, 0x15, 0xd9, 0x12, 0xa0, 0x00, 0xce, 0x5e,
|
||||
0x70, 0x4f, 0x94, 0xba, 0x22, 0x92, 0x52, 0x2d, 0x3b, 0x6d, 0xa6, 0xf3,
|
||||
0xc2, 0x4a, 0x84, 0x87, 0x2d, 0x74, 0x93, 0x81, 0x15, 0x16, 0x9e, 0x19,
|
||||
0x72, 0xb1, 0x0f, 0xed, 0x2f, 0xf7, 0x1c, 0xf7, 0x55, 0xf3, 0x0d, 0xf8,
|
||||
0x6b, 0x76, 0xae, 0x7d, 0x2d, 0xff, 0x57, 0xff, 0xff, 0xd8, 0x5b, 0xce,
|
||||
0xce, 0xda, 0x65, 0x8d, 0x4d, 0x03, 0x90, 0xde, 0xaa, 0xa6, 0xf0, 0xb2,
|
||||
0xe7, 0xb9, 0x42, 0xa1, 0x96, 0xf9, 0x50, 0xb7, 0xd6, 0x3f, 0x02, 0xab,
|
||||
0xa2, 0x5a, 0xd0, 0xe8, 0x48, 0x8b, 0x86, 0x33, 0x4c, 0x72, 0xf6, 0xa6,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x7d, 0x17, 0xf9, 0x76, 0xa0, 0x00, 0xc6, 0x16,
|
||||
0x94, 0xda, 0xe5, 0xef, 0xf3, 0x47, 0x7f, 0x23, 0x41, 0xf5, 0x67, 0x44,
|
||||
0x11, 0xed, 0x73, 0xae, 0x46, 0xa3, 0x85, 0xf0, 0xdb, 0x9f, 0x46, 0x5f,
|
||||
0xbe, 0xb9, 0x83, 0x8d, 0x37, 0xb4, 0xcf, 0x48, 0xa8, 0x38, 0xf8, 0xcc,
|
||||
0x2c, 0xfc, 0x47, 0xbc, 0x29, 0x24, 0xb6, 0x44, 0x90, 0x2c, 0x4c, 0xc5,
|
||||
0x7e, 0xef, 0xff, 0xff, 0xff, 0x7f, 0x7b, 0x19, 0xb1, 0x35, 0xb7, 0xbd,
|
||||
0x40, 0x62, 0xee, 0x8b, 0xf2, 0x00, 0x2f, 0xec, 0xc5, 0x5a, 0xe1, 0x65,
|
||||
0xd3, 0xcc, 0x49, 0x44, 0x22, 0x1e, 0x04, 0x7a, 0xb8, 0xe8, 0xc9, 0xa9,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x70, 0x15, 0x59, 0x36, 0xa8, 0x00, 0xc6, 0x1e,
|
||||
0x70, 0x14, 0xd4, 0x18, 0xed, 0xff, 0x28, 0x1a, 0x3d, 0xde, 0xf4, 0xce,
|
||||
0x77, 0x7a, 0x1b, 0x0e, 0x36, 0xdc, 0xe1, 0xa5, 0x37, 0xc1, 0x9f, 0xad,
|
||||
0xf5, 0xd6, 0xf3, 0xb5, 0xd4, 0x7f, 0xb6, 0xb9, 0x31, 0xad, 0x28, 0xbc,
|
||||
0xd7, 0x56, 0x4f, 0x7e, 0xdb, 0x6f, 0xe0, 0xed, 0x9d, 0x9e, 0x61, 0x28,
|
||||
0x35, 0x15, 0x72, 0x7d, 0xff, 0xff, 0xff, 0xeb, 0xe8, 0xc3, 0x7b, 0x68,
|
||||
0x82, 0xd8, 0xb5, 0x83, 0x72, 0x4c, 0x76, 0xd6, 0xd5, 0x00, 0xa3, 0xa7,
|
||||
0xf8, 0xec, 0x85, 0x0c, 0x24, 0x59, 0x87, 0xdc, 0x44, 0x16, 0x9f, 0x02,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x6d, 0x14, 0x81, 0x32, 0xa4, 0x00, 0xc6, 0x1e,
|
||||
0x70, 0x5b, 0xaf, 0x0f, 0x5e, 0xb1, 0x2a, 0x9b, 0xa3, 0xb3, 0xd4, 0x32,
|
||||
0xd4, 0x2c, 0x97, 0x0e, 0x1e, 0xa2, 0x41, 0x14, 0xe6, 0x27, 0xc3, 0xff,
|
||||
0xdb, 0xdf, 0x2f, 0x6d, 0x7e, 0x97, 0x85, 0xf6, 0x33, 0x54, 0x6e, 0x79,
|
||||
0x82, 0x4a, 0x1a, 0xec, 0xfd, 0x11, 0x1a, 0x48, 0xaa, 0xd5, 0x25, 0x0a,
|
||||
0x40, 0x21, 0xc9, 0xa4, 0xc8, 0x5a, 0x9a, 0x34, 0x89, 0x0e, 0xbc, 0x57,
|
||||
0x6e, 0x88, 0x72, 0x9e, 0x49, 0x44, 0x49, 0x44, 0xe4, 0x7c, 0xb9, 0x13,
|
||||
0x73, 0x70, 0xf9, 0xb7, 0x6a, 0xd7, 0xf8, 0x92, 0x5b, 0x10, 0x7a, 0xbe,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x6e, 0x11, 0x89, 0x12, 0xa8, 0x00, 0xc6, 0x18,
|
||||
0x70, 0x82, 0x80, 0x51, 0x3a, 0x10, 0x0e, 0x40, 0xb7, 0x48, 0x4b, 0x7b,
|
||||
0x04, 0x9a, 0xe9, 0x31, 0xdf, 0x02, 0x38, 0xa1, 0xa1, 0x41, 0x2c, 0x4a,
|
||||
0x3d, 0x41, 0xaf, 0xb5, 0x62, 0x68, 0xb0, 0xe4, 0xb9, 0x3f, 0xff, 0xff,
|
||||
0xff, 0x65, 0x35, 0x9d, 0xee, 0x0e, 0xf1, 0x39, 0x52, 0x3e, 0x44, 0x03,
|
||||
0x9d, 0x97, 0xe3, 0x50, 0x3c, 0x09, 0xaa, 0xf7, 0x4c, 0x84, 0xe2, 0xd8,
|
||||
0xcf, 0xd1, 0x34, 0x2c, 0x7e, 0x0d, 0x6f, 0x75, 0xa9, 0x2b, 0xe5, 0xf9,
|
||||
0xdc, 0x63, 0xf8, 0xd9, 0xbb, 0x4b, 0x69, 0x0e, 0xad, 0x30, 0x27, 0x7a,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x7a, 0x13, 0x19, 0x16, 0xa4, 0x00, 0x7e, 0x12,
|
||||
0x70, 0x7d, 0x37, 0x65, 0xf7, 0xb2, 0xa7, 0x77, 0xc3, 0x95, 0x29, 0x85,
|
||||
0xd3, 0x83, 0x76, 0x59, 0xfd, 0xb7, 0x25, 0x5b, 0xef, 0xe4, 0x61, 0x25,
|
||||
0x8a, 0x18, 0xbf, 0xef, 0xff, 0xff, 0xff, 0xfe, 0xdf, 0xa1, 0xc7, 0x95,
|
||||
0x07, 0x52, 0x1b, 0x2b, 0x77, 0x9d, 0x20, 0x76, 0xe8, 0xad, 0x57, 0x03,
|
||||
0x62, 0x24, 0x7a, 0x97, 0x00, 0xc0, 0x90, 0x1d, 0xc8, 0x97, 0x04, 0x48,
|
||||
0x7a, 0xc7, 0xc8, 0xde, 0xd8, 0x6c, 0xf2, 0x77, 0xc0, 0xdc, 0xde, 0x45,
|
||||
0x17, 0x1e, 0x50, 0x00, 0x46, 0x6e, 0x65, 0x91, 0xbe, 0x4e, 0xfa, 0xa6,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x80, 0x13, 0x71, 0x1e, 0x9c, 0x00, 0xce, 0x5e,
|
||||
0x70, 0xd5, 0x70, 0x3c, 0x9d, 0xb6, 0x91, 0x8c, 0xff, 0x5b, 0xbb, 0xed,
|
||||
0x48, 0x78, 0xa0, 0x8d, 0x22, 0xb5, 0x7d, 0x5f, 0xff, 0xff, 0xaf, 0xfe,
|
||||
0x9f, 0xa9, 0xbd, 0x8c, 0x78, 0x72, 0xe7, 0x81, 0x43, 0x35, 0x98, 0x58,
|
||||
0x85, 0xd4, 0x92, 0xc8, 0xa1, 0xcc, 0x49, 0x0d, 0xda, 0x94, 0xa1, 0xc6,
|
||||
0x11, 0x85, 0x32, 0x8f, 0x6b, 0xf7, 0x42, 0xf6, 0xff, 0xdc, 0x9b, 0xc3,
|
||||
0x78, 0x96, 0xf5, 0x21, 0xf6, 0xad, 0x80, 0x80, 0x5f, 0x27, 0x40, 0xb0,
|
||||
0xca, 0xaf, 0x3b, 0x1c, 0xdf, 0xc9, 0xad, 0xf0, 0x3d, 0x46, 0x70, 0x7a,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x85, 0x12, 0xb1, 0x26, 0x98, 0x00, 0xc5, 0x16,
|
||||
0x70, 0x3d, 0x0d, 0x7f, 0xd7, 0x50, 0x75, 0x4f, 0xbb, 0xff, 0xff, 0xff,
|
||||
0xf2, 0x32, 0xcc, 0x4f, 0xfa, 0x95, 0x7b, 0x2c, 0xd7, 0x56, 0x02, 0x7f,
|
||||
0x8b, 0x32, 0x15, 0x0e, 0x9a, 0x43, 0x71, 0xe8, 0x64, 0x70, 0x31, 0xc5,
|
||||
0x73, 0xc8, 0x7a, 0x7a, 0x9a, 0x7b, 0x76, 0x5b, 0xb4, 0xb7, 0x77, 0x6e,
|
||||
0xc3, 0xbf, 0xf9, 0x45, 0xb9, 0xcf, 0x7c, 0x68, 0xd9, 0x10, 0xfa, 0x0a,
|
||||
0x0d, 0x22, 0x4e, 0x88, 0x8f, 0xfb, 0xdd, 0xff, 0xd6, 0xfb, 0xad, 0xc8,
|
||||
0xd7, 0xd7, 0xf6, 0xf4, 0xff, 0xcb, 0xb8, 0xd7, 0xff, 0xff, 0xff, 0xe2,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x8d, 0x12, 0x91, 0x12, 0x90, 0x00, 0xc6, 0x96,
|
||||
0x70, 0xb0, 0xef, 0xfa, 0x49, 0xa5, 0xca, 0xa8, 0x88, 0xf5, 0x96, 0xc7,
|
||||
0x1f, 0xc0, 0xa3, 0xc0, 0xa4, 0x34, 0x2f, 0x65, 0xee, 0x51, 0x8b, 0x41,
|
||||
0x0d, 0x39, 0x6e, 0xb9, 0x90, 0xc1, 0x07, 0x8a, 0xcb, 0xe1, 0x8a, 0xd5,
|
||||
0xf5, 0x2a, 0x8b, 0x34, 0x91, 0xd1, 0x52, 0xc8, 0xec, 0xed, 0xa9, 0xd5,
|
||||
0x46, 0x61, 0x60, 0xd0, 0x52, 0x4a, 0x41, 0x6d, 0x23, 0x74, 0x56, 0xf7,
|
||||
0x4b, 0x80, 0xc0, 0x3f, 0xfe, 0xa7, 0xae, 0xdb, 0x7f, 0xff, 0xff, 0xff,
|
||||
0xfa, 0x7a, 0xfa, 0x55, 0x46, 0x63, 0x12, 0x28, 0xc1, 0x86, 0x35, 0x34,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x95, 0x12, 0xa1, 0x12, 0x84, 0x00, 0xd6, 0x92,
|
||||
0x70, 0x0f, 0x2d, 0x43, 0x56, 0x10, 0xbb, 0xcb, 0x7a, 0x04, 0x43, 0x12,
|
||||
0xca, 0x82, 0x82, 0x4a, 0x23, 0x58, 0x18, 0x33, 0x5a, 0x72, 0x98, 0x73,
|
||||
0x93, 0x0e, 0xe1, 0x4c, 0xb0, 0x58, 0x0a, 0x5d, 0x98, 0xc6, 0x28, 0x5c,
|
||||
0x58, 0x35, 0x35, 0x08, 0x40, 0x08, 0x97, 0xc6, 0x9a, 0xd6, 0xc1, 0x51,
|
||||
0xa0, 0xa8, 0x35, 0x12, 0xd4, 0x0d, 0x05, 0x4e, 0xea, 0x3d, 0xd4, 0x7b,
|
||||
0xff, 0xff, 0xff, 0xff, 0xfd, 0x2a, 0x10, 0xa4, 0x12, 0x54, 0x7c, 0x38,
|
||||
0xa8, 0x43, 0x2e, 0x16, 0x5e, 0x60, 0x17, 0x0d, 0xad, 0x9d, 0xa6, 0x2d,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0x9d, 0x10, 0x50, 0xaa, 0x7c, 0x00, 0xd6, 0x12,
|
||||
0x4c, 0x55, 0x7e, 0x1c, 0x55, 0x55, 0xb6, 0x06, 0x70, 0x54, 0x32, 0xd6,
|
||||
0x00, 0xa3, 0x5a, 0x59, 0x01, 0x38, 0x44, 0x79, 0x24, 0xce, 0xd2, 0xd6,
|
||||
0x15, 0x0c, 0x99, 0x85, 0x5d, 0x88, 0x81, 0xa5, 0x07, 0x5a, 0x74, 0x4b,
|
||||
0xb4, 0x96, 0xf4, 0xce, 0x86, 0xb5, 0x3e, 0xe5, 0x3d, 0x6b, 0xf7, 0xfc,
|
||||
0x97, 0xd7, 0xfe, 0xaa, 0x02, 0x74, 0x4e, 0x08, 0x59, 0x78, 0x47, 0xa5,
|
||||
0x11, 0xc5, 0xc4, 0x95, 0x13, 0x23, 0x0c, 0xe4, 0x51, 0xb2, 0x39, 0xa0,
|
||||
0x9c, 0x47, 0xf9, 0xb2, 0x71, 0xa2, 0x80, 0x8f, 0x8b, 0x87, 0x8d, 0x93,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xae, 0x12, 0x18, 0xb2, 0x5c, 0x00, 0xd6, 0x12,
|
||||
0x4c, 0x4e, 0x2e, 0x37, 0x3b, 0x3b, 0xb3, 0xfc, 0xb2, 0xd4, 0x3f, 0xd6,
|
||||
0x5b, 0x3f, 0x96, 0x19, 0xac, 0xbd, 0x60, 0xa0, 0x81, 0x03, 0x8f, 0x8b,
|
||||
0x33, 0xff, 0x82, 0xc2, 0xe2, 0x37, 0x7d, 0x4d, 0xfe, 0x2a, 0x28, 0xdf,
|
||||
0xff, 0x16, 0xd4, 0x2f, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e, 0x31, 0x30,
|
||||
0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xb8, 0x11, 0x20, 0xda, 0x00, 0x00, 0x62, 0x06,
|
||||
0x70, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xc6, 0x11, 0xb9, 0x49, 0x90, 0x00, 0x79, 0x86,
|
||||
0x94, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x1c, 0xe0, 0x43, 0x42, 0x88, 0x20,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0x9a, 0x09, 0xa0, 0x5e, 0x03, 0x90, 0x30, 0x02, 0x46, 0x3f, 0xd7,
|
||||
0x8b, 0x61, 0x38, 0x2e, 0x04, 0x81, 0x40, 0x30, 0x05, 0x93, 0xec, 0x2c,
|
||||
0x8c, 0x13, 0x3f, 0x0c, 0x23, 0x36, 0x81, 0xc8, 0xd1, 0xa3, 0xa6, 0xc4,
|
||||
0x00, 0x80, 0x20, 0x18, 0x8a, 0xe2, 0xb2, 0x7b, 0xeb, 0x8b, 0x34, 0x00,
|
||||
0x00, 0x00, 0x03, 0x17, 0xf1, 0x02, 0x00, 0x23, 0xff, 0x10, 0x00, 0x00,
|
||||
0xbf, 0x40, 0x80, 0x00, 0x02, 0x3d, 0x11, 0x11, 0x13, 0x74, 0xc3, 0x81,
|
||||
0x99, 0x71, 0xc0, 0xf8, 0x3e, 0xc0, 0xf9, 0x70, 0x7c, 0x40, 0x08, 0x41,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0x87, 0x1f, 0xc9, 0x88, 0x1f, 0x39, 0xf0, 0xc1, 0x0d, 0x43,
|
||||
0x1d, 0xfc, 0x49, 0x59, 0xf5, 0x9c, 0x89, 0xc3, 0xea, 0x2d, 0xc9, 0x54,
|
||||
0x40, 0xa7, 0x2a, 0x65, 0xd5, 0x2a, 0x58, 0x67, 0xdd, 0xc5, 0x7a, 0x8b,
|
||||
0x54, 0x86, 0xcd, 0x79, 0xc6, 0x92, 0xce, 0x39, 0x51, 0x30, 0x49, 0x10,
|
||||
0xa9, 0xb6, 0x4a, 0xa0, 0x00, 0x48, 0xcb, 0x81, 0x22, 0x23, 0x60, 0x8b,
|
||||
0xad, 0x23, 0x40, 0x30, 0x15, 0x19, 0x00, 0xa0, 0x4a, 0x12, 0x51, 0xa3,
|
||||
0x3a, 0xca, 0xc4, 0xc8, 0x91, 0x6c, 0x56, 0x44, 0xd4, 0x91, 0x6c, 0xa6,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||
0x00, 0xcd, 0x22, 0x9a, 0x4d, 0x7a, 0x35, 0x16, 0xaa, 0x25, 0xa7, 0x58,
|
||||
0x05, 0x4c, 0x95, 0x6f, 0xef, 0x39, 0x26, 0xa2, 0x52, 0x4e, 0xd5, 0x53,
|
||||
0xe5, 0x92, 0x98, 0xaa, 0xce, 0xc4, 0xb6, 0x5e, 0x73, 0xef, 0x67, 0x96,
|
||||
0xdf, 0xfc, 0xb6, 0xcd, 0x56, 0x9d, 0xb2, 0x75, 0x82, 0xcd, 0x23, 0x9e,
|
||||
0x13, 0x12, 0x7c, 0x54, 0x19, 0x11, 0x80, 0xb9, 0x29, 0x22, 0x4b, 0x3b,
|
||||
0x59, 0xd1, 0x2b, 0x83, 0xb5, 0x08, 0x70, 0xc9, 0x27, 0x87, 0x5a, 0x81,
|
||||
0x8d, 0x74, 0x7a, 0x9b, 0x07, 0xb2, 0x2d, 0x38, 0x27, 0x30, 0x7c, 0x95,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xff, 0x1b, 0x19, 0x7d, 0xf0, 0x00, 0x7a, 0x46,
|
||||
0x94, 0x12, 0xa9, 0xa9, 0x3a, 0xb9, 0x2a, 0x58, 0xe9, 0xd4, 0x97, 0x84,
|
||||
0xe0, 0xed, 0xfd, 0xca, 0x88, 0xa8, 0xa9, 0xfe, 0xe5, 0x30, 0x50, 0x40,
|
||||
0x8e, 0x47, 0xcc, 0x50, 0x40, 0x84, 0x86, 0x9f, 0xfe, 0x02, 0x09, 0x0a,
|
||||
0x86, 0x6b, 0x14, 0x6f, 0xeb, 0x14, 0xe2, 0xc2, 0xba, 0xc5, 0x1a, 0x81,
|
||||
0xe2, 0xa2, 0xd8, 0x48, 0x5c, 0x46, 0xe8, 0xa8, 0xb2, 0x4c, 0x41, 0x4d,
|
||||
0x45, 0x33, 0x2e, 0x31, 0x30, 0x30, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xe5, 0x1f, 0x9a, 0x31, 0xf8, 0x00, 0xc2, 0x4c,
|
||||
0xb8, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xff, 0xf3, 0x44, 0xc4, 0xb9, 0x12, 0xa9, 0x25, 0x88, 0x00, 0x7a, 0x44,
|
||||
0x70, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
|
||||
};
|
||||
unsigned int zero_mp3_len = 4320;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file streams-mixer-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Simple Demo for mixing 2 input streams
|
||||
* @version 0.1
|
||||
* @date 2022-11-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "drums.h"
|
||||
#include "guitar.h"
|
||||
|
||||
InputMixer<int16_t> mixer;
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
MemoryStream drums(drums_raw, drums_raw_len);
|
||||
MemoryStream guitar(guitar_raw, guitar_raw_len);
|
||||
StreamCopy copier(kit, mixer);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// auto restart when MemoryStream has ended
|
||||
drums.setLoop(true);
|
||||
guitar.setLoop(true);
|
||||
|
||||
// setup output
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.channels = 1;
|
||||
cfg.sample_rate = 8000;
|
||||
kit.begin(cfg);
|
||||
// max volume
|
||||
kit.setVolume(1.0);
|
||||
|
||||
mixer.add(drums);
|
||||
mixer.add(guitar);
|
||||
mixer.begin(cfg);
|
||||
|
||||
}
|
||||
|
||||
void loop() { copier.copy(); }
|
||||
@@ -0,0 +1,18 @@
|
||||
# AudioActions
|
||||
|
||||
Originally I was of the opinion that the program logic for __reading of the GPIO pins__ and the processing of the related actions should belong into a specific __Arduino sketch__ and should not be part of an Audio Framework.
|
||||
|
||||
The [Audio Kit](https://docs.ai-thinker.com/en/esp32-audio-kit) made me revise this because I think that an Arduino Sketch should be __as concise as possible__. For this I have created the AudioActions class which has been integrated into the AudioKit.
|
||||
|
||||
Since the Audio Kit does not have any display, I think to use TTS is a good choice.
|
||||
You just need to define you __handler methods__ (button1, button2...) and assign them to the __GPIO pins__.
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||
- [Audio Driver](https://github.com/pschatzmann/arduino-audio-driver)
|
||||
- [FLITE](https://github.com/pschatzmann/arduino-flite)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @file stream-pins-audiokit.ino
|
||||
* @brief see
|
||||
* https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-pins-audiokit/README.md
|
||||
* @author Phil Schatzmann
|
||||
* @copyright Copyright (c) 2021
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "flite_arduino.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
Flite flite(kit);
|
||||
|
||||
void button1(bool, int, void*) { flite.say("Button One"); }
|
||||
void button2(bool, int, void*) { flite.say("Button Two"); }
|
||||
void button3(bool, int, void*) { flite.say("Button Three"); }
|
||||
void button4(bool, int, void*) { flite.say("Button Four"); }
|
||||
|
||||
// Arduino setup
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
//AUDIOKIT_LOG_LEVEL = AudioKitDebug;
|
||||
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.bits_per_sample = 16;
|
||||
cfg.channels = 1;
|
||||
cfg.sample_rate = 8000;
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
|
||||
// Assign pins to methods
|
||||
kit.addAction(kit.getKey(1), button1);
|
||||
kit.addAction(kit.getKey(2), button2);
|
||||
kit.addAction(kit.getKey(3), button3);
|
||||
kit.addAction(kit.getKey(4), button4);
|
||||
|
||||
// example with actions using lambda expression
|
||||
auto down = [](bool,int,void*) { AudioBoardStream::actionVolumeDown(true, -1, nullptr); flite.say("Volume down"); };
|
||||
kit.addAction(kit.getKey(5), down);
|
||||
auto up = [](bool,int,void*) { AudioBoardStream::actionVolumeUp(true, -1, nullptr ); flite.say("Volume up"); };
|
||||
kit.addAction(kit.getKey(6), up);
|
||||
|
||||
flite.say("Please push a button");
|
||||
}
|
||||
|
||||
// Arduino Loop
|
||||
void loop() { kit.processActions(); }
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioInfo info(44100, 2, 16);
|
||||
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
RTTTLOutput<int16_t> rtttl(sineWave, out);
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
delay(5000);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto config = out.defaultConfig(TX_MODE);
|
||||
config.copyFrom(info);
|
||||
out.begin(config);
|
||||
|
||||
// Setup sine wave (optional)
|
||||
sineWave.begin(info);
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() {
|
||||
rtttl.begin(info);
|
||||
rtttl.print("ComplexDemo: d=8, o=5, b=140: c4 e g c6 a5 g4 e g a g4 e c4 e2 g4 c6 a5 g4 e g a g4 e c2 p c4 e g c6 a5 g4 e g a g4 e c4 e2 g4 c6 a5 g4 e g a g4 e c2");
|
||||
delay(1000);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file streams-sd-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Just a small demo, how to use files with the SD library with a streaming decoder
|
||||
* @version 0.1
|
||||
* @date 2022-10-09
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioCodecs/CodecFLAC.h"
|
||||
|
||||
|
||||
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||
FLACDecoder dec;
|
||||
File audioFile;
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup audiokit before SD!
|
||||
auto config = i2s.defaultConfig(TX_MODE);
|
||||
config.sd_active = true;
|
||||
i2s.begin(config);
|
||||
|
||||
// setup file
|
||||
SD.begin(chipSelect);
|
||||
audioFile = SD.open("/flac/test2.flac");
|
||||
|
||||
// setup decoder
|
||||
dec.setInput(audioFile);
|
||||
dec.setOutput(i2s);
|
||||
dec.begin();
|
||||
|
||||
}
|
||||
|
||||
void loop(){
|
||||
dec.copy();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @file streams-sd_m4a-audiokit.ino
|
||||
* @author Peter Schatzmann
|
||||
* @brief Example for decoding M4A files on the AudioKit using the AudioBoardStream
|
||||
* @version 0.1
|
||||
* @date 2023-10-01
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecALAC.h"
|
||||
#include "AudioTools/AudioCodecs/CodecAACHelix.h"
|
||||
#include "AudioTools/AudioCodecs/ContainerM4A.h"
|
||||
#include "AudioTools/AudioCodecs/MultiDecoder.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
|
||||
#include "SD.h"
|
||||
|
||||
MultiDecoder multi_decoder;
|
||||
ContainerM4A dec_m4a(multi_decoder);
|
||||
AACDecoderHelix dec_aac;
|
||||
DecoderALAC dec_alac;
|
||||
AudioBoardStream out(AudioKitEs8388V1);
|
||||
EncodedAudioOutput decoder_output(&out, &dec_m4a);
|
||||
File file;
|
||||
StreamCopy copier(decoder_output, file);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// start AudioBoard with setup of CD pins
|
||||
auto cfg = out.defaultConfig(TX_MODE);
|
||||
cfg.sd_active = true;
|
||||
if (!out.begin(cfg)){
|
||||
Serial.println("Failed to start CSV output!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)){
|
||||
Serial.println("SD Card initialization failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
file = SD.open("/m4a/aac.m4a");
|
||||
if (!file) {
|
||||
Serial.println("Failed to open file!");
|
||||
return;
|
||||
}
|
||||
|
||||
// mp4 supports alac and aac
|
||||
multi_decoder.addDecoder(dec_alac,"audio/alac");
|
||||
multi_decoder.addDecoder(dec_aac,"audio/aac");
|
||||
|
||||
// start decoder output
|
||||
if(!decoder_output.begin()) {
|
||||
Serial.println("Failed to start decoder output!");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.println("M4A decoding started...");
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file streams-sd-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief Just a small demo, how to use files with the SD library
|
||||
* @version 0.1
|
||||
* @date 2022-10-09
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||
|
||||
|
||||
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||
EncodedAudioStream decoder(&i2s, new MP3DecoderHelix()); // Decoding stream
|
||||
StreamCopy copier;
|
||||
File audioFile;
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// setup audiokit before SD!
|
||||
auto config = i2s.defaultConfig(TX_MODE);
|
||||
config.sd_active = true;
|
||||
i2s.begin(config);
|
||||
|
||||
// setup file
|
||||
SD.begin(chipSelect);
|
||||
audioFile = SD.open("/ZZ Top/Unknown Album/Lowrider.mp3");
|
||||
|
||||
// setup I2S based on sampling rate provided by decoder
|
||||
decoder.begin();
|
||||
|
||||
// begin copy
|
||||
copier.begin(decoder, audioFile);
|
||||
|
||||
}
|
||||
|
||||
void loop(){
|
||||
if (!copier.copy()) {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @file streams-sdmmc_wav-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief A simple example that shows how to play (eg. a 24bit) wav file
|
||||
* @date 2021-11-07
|
||||
*
|
||||
* @copyright Copyright (c) 2021
|
||||
*/
|
||||
|
||||
|
||||
#include "FS.h"
|
||||
#include "SD_MMC.h"
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioBoardStream i2s(AudioKitEs8388V1);
|
||||
WAVDecoder wav;
|
||||
EncodedAudioStream encoded(&i2s, &wav); // Decoding stream
|
||||
File audioFile;
|
||||
StreamCopy copier(encoded, audioFile);
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// setup audiokit before SD!
|
||||
auto config = i2s.defaultConfig(TX_MODE);
|
||||
config.sd_active = false;
|
||||
i2s.begin(config);
|
||||
i2s.setVolume(1.0);
|
||||
|
||||
// open sdmmc
|
||||
if (!SD_MMC.begin("/sdcard", false)){
|
||||
Serial.println("SD_MMC Error");
|
||||
stop();
|
||||
}
|
||||
// open file
|
||||
audioFile = SD_MMC.open("/wav24/test.wav");
|
||||
if (!audioFile){
|
||||
Serial.println("File does not exist");
|
||||
stop();
|
||||
}
|
||||
|
||||
// start decoder stream
|
||||
encoded.begin();
|
||||
}
|
||||
|
||||
void loop(){
|
||||
copier.copy();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# A Simple Synthesizer for the AI Thinker AudioKit
|
||||
|
||||
I was taking the synthbasic example, extended it to handle multiple keys at the same time and wrapped it into a nice, easy to use class.
|
||||
|
||||
Here is a Synthesizer in just 30 lines of code..
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||
- [Midi](https://github.com/pschatzmann/arduino-midi)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file streams-synth-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
Synthesizer synthesizer;
|
||||
GeneratedSoundStream<int16_t> in(synthesizer);
|
||||
StreamCopy copier(kit, in);
|
||||
SynthesizerKey keys[] = {{kit.getKey(1), N_C3},{kit.getKey(2), N_D3},{kit.getKey(3), N_E3},{kit.getKey(4), N_F3},{kit.getKey(5), N_G3},{kit.getKey(6), N_A3},{0,0}};
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||
|
||||
// Setup output
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(80);
|
||||
|
||||
// define synthesizer keys for AudioKit
|
||||
synthesizer.setKeys(kit.audioActions(), keys, AudioActions::ActiveLow);
|
||||
synthesizer.setMidiName("AudioKit Synthesizer");
|
||||
// Setup sound generation & synthesizer based on AudioKit default settings
|
||||
in.begin(cfg);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
copier.copy();
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||
|
||||
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @file streams-synthbasic-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||
* @copyright GPLv3
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
SineWaveGenerator<int16_t> sine;
|
||||
GeneratedSoundStream<int16_t> in(sine);
|
||||
StreamCopy copier(kit, in);
|
||||
|
||||
void actionKeyOn(bool active, int pin, void* ptr){
|
||||
int freq = *((float*)ptr);
|
||||
sine.setFrequency(freq);
|
||||
in.begin();
|
||||
}
|
||||
|
||||
void actionKeyOff(bool active, int pin, void* ptr){
|
||||
in.end();
|
||||
}
|
||||
|
||||
// We want to play some notes on the AudioKit keys
|
||||
void setupActions(){
|
||||
// assign buttons to notes
|
||||
auto act_low = AudioActions::ActiveLow;
|
||||
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial,AudioLogger::Info);
|
||||
|
||||
// Setup output
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(80);
|
||||
|
||||
// Setup sound generation based on AudioKit settins
|
||||
in.begin(cfg);
|
||||
|
||||
// activate keys
|
||||
setupActions();
|
||||
|
||||
}
|
||||
|
||||
// copy the data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||
|
||||
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @file streams-synthbasic-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||
* ADSR
|
||||
* @copyright GPLv3
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
SineWaveGenerator<int16_t> sine;
|
||||
GeneratedSoundStream<int16_t> sine_stream(sine);
|
||||
AudioEffectStream effects(sine_stream);
|
||||
ADSRGain adsr(0.0001,0.0001, 0.9 , 0.0002);
|
||||
StreamCopy copier(kit, effects);
|
||||
|
||||
void actionKeyOn(bool active, int pin, void* ptr){
|
||||
Serial.println("KeyOn");
|
||||
float freq = *((float*)ptr);
|
||||
sine.setFrequency(freq);
|
||||
adsr.keyOn();
|
||||
}
|
||||
|
||||
void actionKeyOff(bool active, int pin, void* ptr){
|
||||
Serial.println("KeyOff");
|
||||
adsr.keyOff();
|
||||
}
|
||||
|
||||
// We want to play some notes on the AudioKit keys
|
||||
void setupActions(){
|
||||
// assign buttons to notes
|
||||
auto act_low = AudioActions::ActiveLow;
|
||||
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||
|
||||
// setup effects
|
||||
effects.addEffect(adsr);
|
||||
|
||||
// Setup output
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(80);
|
||||
|
||||
// Setup sound generation based on AudioKit settins
|
||||
sine.begin(cfg, 0);
|
||||
sine_stream.begin(cfg);
|
||||
effects.begin(cfg);
|
||||
|
||||
// activate keys
|
||||
setupActions();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// copy the data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||
|
||||
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||
- [Arduino Audio Tools - Midi](https://github.com/pschatzmann/arduino-midi)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @file streams-synthbasic-audiokit.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||
* Midi Support
|
||||
* @copyright GPLv3
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include <Midi.h>
|
||||
|
||||
SineWaveGenerator<int16_t> sine;
|
||||
GeneratedSoundStream<int16_t> sine_stream(sine);
|
||||
ADSRGain adsr(0.0001,0.0001, 0.9 , 0.0002);
|
||||
AudioEffectStream effects(sine_stream);
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
StreamCopy copier(kit, effects);
|
||||
|
||||
class SynthAction : public MidiAction {
|
||||
public:
|
||||
void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
|
||||
int frq = MidiCommon::noteToFrequency(note);
|
||||
sine.setFrequency(frq);
|
||||
adsr.keyOn();
|
||||
}
|
||||
void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity) {
|
||||
adsr.keyOff();
|
||||
}
|
||||
void onControlChange(uint8_t channel, uint8_t controller, uint8_t value) {}
|
||||
void onPitchBend(uint8_t channel, uint8_t value) {}
|
||||
} action;
|
||||
|
||||
MidiBleServer ble("MidiServer", &action);
|
||||
|
||||
|
||||
void actionKeyOn(bool active, int pin, void* ptr){
|
||||
Serial.println("KeyOn");
|
||||
float freq = *((float*)ptr);
|
||||
sine.setFrequency(freq);
|
||||
adsr.keyOn();
|
||||
}
|
||||
|
||||
void actionKeyOff(bool active, int pin, void* ptr){
|
||||
Serial.println("KeyOff");
|
||||
adsr.keyOff();
|
||||
}
|
||||
|
||||
// We want to play some notes on the AudioKit keys
|
||||
void setupActions(){
|
||||
// assign buttons to notes
|
||||
auto act_low = AudioActions::ActiveLow;
|
||||
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||
|
||||
// setup effects
|
||||
effects.addEffect(adsr);
|
||||
|
||||
// Setup output
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
kit.setVolume(80);
|
||||
|
||||
// Setup sound generation based on AudioKit settins
|
||||
sine.begin(cfg, 0);
|
||||
sine_stream.begin(cfg);
|
||||
effects.begin(cfg);
|
||||
|
||||
// activate keys
|
||||
setupActions();
|
||||
}
|
||||
|
||||
// copy the data
|
||||
void loop() {
|
||||
copier.copy();
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Implementing a Synthesizer using the STK Framwork
|
||||
|
||||
We can use the STK framework to implement a Synthesizer which receives Midi Messages and translates them
|
||||
into sound. Here we use a Clarinet...
|
||||
|
||||
For [further info see my blog](https://www.pschatzmann.ch/home/2021/12/21/ai-thinker-audiokit-a-simply-synthesizer-with-stk/)
|
||||
|
||||
### Dependencies
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
- https://github.com/pschatzmann/arduino-midi
|
||||
- https://github.com/pschatzmann/Arduino-STK
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @file streams-synthstk-audiokit.ino
|
||||
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audiokit-a-simple-synthesizer-with-stk/
|
||||
* @author Phil Schatzmann
|
||||
* @copyright Copyright (c) 2021
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "StkAll.h"
|
||||
|
||||
AudioBoardStream kit(AudioKitEs8388V1);
|
||||
Clarinet clarinet(440);
|
||||
Voicer voicer;
|
||||
ArdStreamOut output(&kit);
|
||||
float noteAmplitude = 128;
|
||||
int group = 0;
|
||||
|
||||
void actionKeyOn(bool active, int pin, void* ptr){
|
||||
float note = *((float*)ptr);
|
||||
voicer.noteOn(note, noteAmplitude, group);
|
||||
}
|
||||
|
||||
void actionKeyOff(bool active, int pin, void* ptr){
|
||||
float note = *((float*)ptr);
|
||||
voicer.noteOff(note, noteAmplitude, group);
|
||||
}
|
||||
|
||||
// We want to play some notes on the AudioKit keys
|
||||
void setupActions(){
|
||||
// assign buttons to notes
|
||||
auto act_low = AudioActions::ActiveLow;
|
||||
static int note[] = {48,50,52,53,55,57}; // midi keys
|
||||
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||
|
||||
voicer.addInstrument(&clarinet, group);
|
||||
|
||||
// define data format
|
||||
auto cfg = kit.defaultConfig(TX_MODE);
|
||||
cfg.channels = 1;
|
||||
cfg.bits_per_sample = 16;
|
||||
cfg.sample_rate = Stk::sampleRate();
|
||||
cfg.sd_active = false;
|
||||
kit.begin(cfg);
|
||||
|
||||
// play notes with keys
|
||||
setupActions();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
for (int j=0;j<1024;j++) {
|
||||
output.tick( voicer.tick() );
|
||||
}
|
||||
kit.processActions();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
## Using the AI Thinker ESP32 with Tensoflow Lite to Generate Audio
|
||||
|
||||
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board. You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies.
|
||||
|
||||
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||
|
||||
|
||||
The starting point is the good overview provided by [the "Hallo World" example of Tensorflow Lite](https://www.tensorflow.org/lite/microcontrollers/get_started_low_level#train_a_model) which describes how to create, train and use a model which based on the __sine function__. Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Tensorflow-Lite----Audio-Output/_edit)
|
||||
|
||||
|
||||
### Note
|
||||
|
||||
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
You need to install the following libraries:
|
||||
|
||||
- https://github.com/pschatzmann/arduino-audio-tools
|
||||
- https://github.com/pschatzmann/arduino-audio-driver
|
||||
- https://github.com/pschatzmann/tflite-micro-arduino-examples
|
||||
@@ -0,0 +1,206 @@
|
||||
#pragma once
|
||||
|
||||
const unsigned char g_model[] = {
|
||||
0x20, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x00, 0x00,
|
||||
0x14, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00,
|
||||
0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x14, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
|
||||
0x28, 0x01, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
|
||||
0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x10, 0x09, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0xdc, 0x07, 0x00, 0x00,
|
||||
0x30, 0x07, 0x00, 0x00, 0xbc, 0x05, 0x00, 0x00, 0x18, 0x05, 0x00, 0x00,
|
||||
0x94, 0x04, 0x00, 0x00, 0x2c, 0x04, 0x00, 0x00, 0xf0, 0x08, 0x00, 0x00,
|
||||
0xec, 0x08, 0x00, 0x00, 0xe8, 0x08, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
|
||||
0x10, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||
0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34, 0x00, 0xba, 0xf8, 0xff, 0xff,
|
||||
0x04, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||
0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00,
|
||||
0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x6d, 0x69, 0x6e, 0x5f,
|
||||
0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x00, 0x0a, 0xf9, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x31, 0x2e, 0x31, 0x34, 0x2e, 0x30, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x4d, 0x4c, 0x49, 0x52, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74,
|
||||
0x65, 0x64, 0x2e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x04, 0x00,
|
||||
0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00,
|
||||
0x14, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
|
||||
0x44, 0x07, 0x00, 0x00, 0xc8, 0x06, 0x00, 0x00, 0x3c, 0x06, 0x00, 0x00,
|
||||
0x88, 0x05, 0x00, 0x00, 0x24, 0x04, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00,
|
||||
0xfc, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, 0x1c, 0x01, 0x00, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0xc0, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5a, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x08, 0x18, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xa0, 0xf8, 0xff, 0xff,
|
||||
0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
|
||||
0x54, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00,
|
||||
0x0a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x53, 0x74, 0x61, 0x74,
|
||||
0x65, 0x66, 0x75, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x3a, 0x30, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||
0x3c, 0xf9, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x2c, 0xce, 0x0a, 0x3c, 0x01, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
|
||||
0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00,
|
||||
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x0c, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09,
|
||||
0x14, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
|
||||
0x78, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
|
||||
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
|
||||
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74,
|
||||
0x4d, 0x75, 0x6c, 0x3b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33,
|
||||
0x2f, 0x52, 0x65, 0x6c, 0x75, 0x3b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e,
|
||||
0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65,
|
||||
0x5f, 0x33, 0x2f, 0x42, 0x69, 0x61, 0x73, 0x41, 0x64, 0x64, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00,
|
||||
0x2c, 0xfa, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0xe4, 0xd1, 0xc0, 0x3b, 0x01, 0x00, 0x00, 0x00,
|
||||
0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00,
|
||||
0x07, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||
0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0b, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x24, 0xfb, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x18, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
0x52, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
|
||||
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x3b, 0x73, 0x65, 0x71, 0x75,
|
||||
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
|
||||
0x73, 0x65, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x3b, 0x73, 0x65,
|
||||
0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64,
|
||||
0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x2f, 0x42, 0x69, 0x61, 0x73, 0x41,
|
||||
0x64, 0x64, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0x10, 0x00, 0x00, 0x00, 0x44, 0xfb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0xdf, 0x47, 0x3c,
|
||||
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x6a, 0xfc, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x8c, 0xef, 0xff, 0xff, 0x56, 0xfc, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||
0x65, 0x5f, 0x34, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||
0xac, 0xfb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x22, 0xd9, 0x51, 0x38, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xfc, 0xff, 0xff,
|
||||
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x21, 0xa5, 0x8b, 0xca,
|
||||
0x5e, 0x1d, 0xce, 0x42, 0x9d, 0xce, 0x1f, 0xb0, 0xdf, 0x54, 0x2f, 0x81,
|
||||
0xc6, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||
0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34,
|
||||
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x2c, 0xfc, 0xff, 0xff,
|
||||
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0xce, 0x4d, 0x0b, 0x3c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4e, 0xfd, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x04, 0x00, 0x00,
|
||||
0x78, 0x0a, 0x00, 0x00, 0x2d, 0x06, 0x00, 0x00, 0x71, 0xf8, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x99, 0x0a, 0x00, 0x00, 0xfe, 0xf7, 0xff, 0xff,
|
||||
0x0f, 0x05, 0x00, 0x00, 0xd4, 0x09, 0x00, 0x00, 0x47, 0xfe, 0xff, 0xff,
|
||||
0xb6, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xf7, 0xff, 0xff,
|
||||
0x4b, 0xf9, 0xff, 0xff, 0x4a, 0x05, 0x00, 0x00, 0x76, 0xfd, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||
0x65, 0x5f, 0x33, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||
0xcc, 0xfc, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0xb2, 0x9e, 0x21, 0x39, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xfd, 0xff, 0xff,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xee, 0xfc, 0x00, 0xec,
|
||||
0x05, 0x17, 0xef, 0xec, 0xe6, 0xf8, 0x03, 0x01, 0x00, 0xfa, 0xf8, 0xf5,
|
||||
0xdc, 0xeb, 0x27, 0x14, 0xf1, 0xde, 0xe2, 0xdb, 0xf0, 0xde, 0x31, 0x06,
|
||||
0x02, 0xe6, 0xee, 0xf9, 0x00, 0x16, 0x07, 0xe0, 0xfe, 0xff, 0xe9, 0x06,
|
||||
0xe7, 0xef, 0x81, 0x1b, 0x18, 0xea, 0xc9, 0x01, 0x0f, 0x00, 0xda, 0xf7,
|
||||
0x0e, 0xec, 0x13, 0x1f, 0x04, 0x13, 0xb4, 0xe6, 0xfd, 0x06, 0xb9, 0xe0,
|
||||
0x0d, 0xec, 0xf0, 0xde, 0xeb, 0xf7, 0x05, 0x26, 0x1a, 0xe4, 0x6f, 0x1a,
|
||||
0xea, 0x1e, 0x35, 0xdf, 0x1a, 0xf3, 0xf1, 0x19, 0x0f, 0x03, 0x1b, 0xe1,
|
||||
0xde, 0x13, 0xf6, 0x19, 0xff, 0xf6, 0x1b, 0x18, 0xf0, 0x1c, 0xda, 0x1b,
|
||||
0x1b, 0x20, 0xe5, 0x1a, 0xf5, 0xff, 0x96, 0x0b, 0x00, 0x01, 0xcd, 0xde,
|
||||
0x0d, 0xf6, 0x16, 0xe3, 0xed, 0xfc, 0x0e, 0xe9, 0xfa, 0xeb, 0x5c, 0xfc,
|
||||
0x1d, 0x02, 0x5b, 0xe2, 0xe1, 0xf5, 0x15, 0xec, 0xf4, 0x00, 0x13, 0x05,
|
||||
0xec, 0x0c, 0x1d, 0x14, 0x0e, 0xe7, 0x0b, 0xf4, 0x19, 0x00, 0xd7, 0x05,
|
||||
0x27, 0x02, 0x15, 0xea, 0xea, 0x02, 0x9b, 0x00, 0x0c, 0xfa, 0xe8, 0xea,
|
||||
0xfd, 0x00, 0x14, 0xfd, 0x0b, 0x02, 0xef, 0xee, 0x06, 0xee, 0x01, 0x0d,
|
||||
0x06, 0xe6, 0xf7, 0x11, 0xf7, 0x09, 0xf8, 0xf1, 0x21, 0xff, 0x0e, 0xf3,
|
||||
0xec, 0x12, 0x26, 0x1d, 0xf2, 0xe9, 0x28, 0x18, 0xe0, 0xfb, 0xf3, 0xf4,
|
||||
0x05, 0x1d, 0x1d, 0xfb, 0xfd, 0x1e, 0xfc, 0x11, 0xe8, 0x07, 0x09, 0x03,
|
||||
0x12, 0xf2, 0x36, 0xfb, 0xdc, 0x1c, 0xf9, 0xef, 0xf3, 0xe7, 0x6f, 0x0c,
|
||||
0x1d, 0x00, 0x45, 0xfd, 0x0e, 0xf0, 0x0b, 0x19, 0x1a, 0xfa, 0xe0, 0x19,
|
||||
0x1f, 0x13, 0x36, 0x1c, 0x12, 0xeb, 0x3b, 0x0c, 0xb4, 0xcb, 0xe6, 0x13,
|
||||
0xfa, 0xeb, 0xf1, 0x06, 0x1c, 0xfa, 0x18, 0xe5, 0xeb, 0xcb, 0x0c, 0xf4,
|
||||
0xd6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33,
|
||||
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x3c, 0xfe, 0xff, 0xff,
|
||||
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x6b, 0x01, 0x4f, 0x3c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x77, 0x0b, 0x00, 0x00,
|
||||
0x53, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x77, 0x0c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x06, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x21, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x2f, 0x07, 0x00, 0x00, 0x67, 0xf5, 0xff, 0xff,
|
||||
0x34, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x86, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||
0x65, 0x5f, 0x32, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||
0xdc, 0xfe, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x28, 0xb3, 0xd9, 0x38, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
|
||||
0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x75, 0x1c, 0x11, 0xe1, 0x0c, 0x81, 0xa5, 0x42,
|
||||
0xfe, 0xd5, 0xd4, 0xb2, 0x61, 0x78, 0x19, 0xdf, 0x00, 0x00, 0x0e, 0x00,
|
||||
0x18, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00,
|
||||
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
|
||||
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x74, 0xff, 0xff, 0xff,
|
||||
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0xd5, 0x6b, 0x8a, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x07, 0x00,
|
||||
0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
|
||||
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f,
|
||||
0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75,
|
||||
0x74, 0x3a, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5d, 0x4f, 0xc9, 0x3c,
|
||||
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int g_model_len = 2408;
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file streams-tf-i2s.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief We use Tenorflow lite to generate some audio data and output it via I2S to the AudioKit
|
||||
* @version 0.1
|
||||
* @date 2022-04-07
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioLibs/TfLiteAudioStream.h"
|
||||
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||
#include "model.h"
|
||||
|
||||
TfLiteSineReader tf_reader(20000,0.3); // Audio generation logic
|
||||
TfLiteAudioStream tf_stream; // Audio source -> no classification so N is 0
|
||||
AudioBoardStream i2s(AudioKitEs8388V1); // Audio destination
|
||||
StreamCopy copier(i2s, tf_stream); // copy tf_stream to i2s
|
||||
int channels = 1;
|
||||
int samples_per_second = 16000;
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// Setup tensorflow input
|
||||
auto tcfg = tf_stream.defaultConfig();
|
||||
tcfg.channels = channels;
|
||||
tcfg.sample_rate = samples_per_second;
|
||||
tcfg.kTensorArenaSize = 2 * 1024;
|
||||
tcfg.model = g_model;
|
||||
tcfg.reader = &tf_reader;
|
||||
tf_stream.begin(tcfg);
|
||||
|
||||
// setup Audioi2s output
|
||||
auto cfg = i2s.defaultConfig(TX_MODE);
|
||||
cfg.channels = channels;
|
||||
cfg.sample_rate = samples_per_second;
|
||||
i2s.begin(cfg);
|
||||
|
||||
}
|
||||
|
||||
void loop() { copier.copy(); }
|
||||
Reference in New Issue
Block a user