-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d4f3eb
commit fbd9edf
Showing
6 changed files
with
648 additions
and
1 deletion.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
examples/examples-communication/vban/streams-audiokit-vban/streams-audiokit-vban
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @file streams-i2s-vban.ino | ||
* @author Phil Schatzmann | ||
* @brief sends signal from i2s (using an AudioKit) to VBAN Receptor App | ||
*/ | ||
|
||
#include "AudioTools.h" | ||
#include "AudioLibs/VBANStream.h" | ||
#include "AudioLibs/AudioKit.h" // comment out when not using AudioKit | ||
|
||
AudioInfo info(44100, 2, 16); | ||
AudioKitStream in; // Audio source e.g. replace with I2SStream | ||
VBANStream out; | ||
StreamCopy copier(out, in, 2048); // copies sound into i2s | ||
|
||
// Arduino Setup | ||
void setup(void) { | ||
// Open Serial | ||
Serial.begin(115200); | ||
while(!Serial); | ||
AudioLogger::instance().begin(Serial, AudioLogger::Info); | ||
|
||
// setup output | ||
auto cfg = out.defaultConfig(TX_MODE); | ||
cfg.copyFrom(info); | ||
cfg.ssid = "ssid"; | ||
cfg.password = "password"; | ||
cfg.stream_name = "Stream1"; | ||
cfg.target_ip = IPAddress{192,168,1,37}; // comment out to broadcast | ||
cfg.throttle_active = false; // generator is much too fast, we need to stall | ||
if (!out.begin(cfg)) stop(); | ||
|
||
// Setup input from mic | ||
// setup input | ||
auto cfg_in = in.defaultConfig(RX_MODE); | ||
cfg_in.sd_active = false; | ||
cfg_in.buffer_size = 256; | ||
cfg_in.buffer_count = 4; | ||
cfg_in.copyFrom(info); | ||
cfg_in.input_device = AUDIO_HAL_ADC_INPUT_LINE2; // microphone | ||
in.begin(cfg_in); | ||
} | ||
|
||
// Arduino loop - copy sound to out | ||
void loop() { | ||
copier.copy(); | ||
} |
42 changes: 42 additions & 0 deletions
42
examples/examples-communication/vban/streams-generator-vban/streams-generator-vban.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file streams-generator-vban.ino | ||
* @author Phil Schatzmann | ||
* @brief sends sine test signal to VBAN Receptor App | ||
*/ | ||
|
||
#include "AudioTools.h" | ||
#include "AudioLibs/VBANStream.h" | ||
|
||
AudioInfo info(44100, 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 | ||
VBANStream out; | ||
StreamCopy copier(out, sound, 2048); // 44100 needs 2048 | ||
|
||
// Arduino Setup | ||
void setup(void) { | ||
// Open Serial | ||
Serial.begin(115200); | ||
while(!Serial); | ||
AudioLogger::instance().begin(Serial, AudioLogger::Info); | ||
|
||
// setup output | ||
auto cfg = out.defaultConfig(TX_MODE); | ||
cfg.copyFrom(info); | ||
cfg.ssid = "ssid"; | ||
cfg.password = "password"; | ||
cfg.stream_name = "Stream1"; | ||
cfg.target_ip = IPAddress{192,168,1,37}; | ||
cfg.throttle_active = true; | ||
cfg.throttle_correction_ms = -4; // optimize overload and underrun | ||
if (!out.begin(cfg)) stop(); | ||
|
||
// Setup sine wave | ||
sineWave.begin(info, N_B4); | ||
Serial.println("started..."); | ||
} | ||
|
||
// Arduino loop - copy sound to out | ||
void loop() { | ||
copier.copy(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.