-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
00accd5
commit 9213f4c
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
examples/examples-custom-boards/lyrat-mini/output/outout.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,36 @@ | ||
// Demo to output audio on a lyrat-mini board: with headphone detection active | ||
// to switch the power amplifier on and off | ||
|
||
#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 | ||
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave | ||
AudioBoardStream out(LyratMini); | ||
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); | ||
|
||
// additinal settings | ||
out.setVolume(0.5); | ||
out.addHeadphoneDetectionAction(); | ||
|
||
// start sine wave | ||
sineWave.begin(info, N_B4); | ||
Serial.println("started..."); | ||
} | ||
|
||
void loop() { | ||
copier.copy(); | ||
out.processActions(); | ||
} |
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