-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
2d3fc49
commit 2e88628
Showing
5 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
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
41 changes: 41 additions & 0 deletions
41
examples/tests/codecs/test-codec-wav-adpcm/test-codec-wav-adpcm.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,41 @@ | ||
#include "AudioTools.h" | ||
#include "AudioCodecs/CodecWAV.h" | ||
#include "AudioCodecs/CodecADPCM.h" | ||
|
||
AudioInfo info(16000, 2, 16); | ||
SineWaveGenerator<int16_t> sineWave( 32000); | ||
GeneratedSoundStream<int16_t> sound( sineWave); | ||
CsvOutput<int16_t> out(Serial); | ||
AVCodecID id = AV_CODEC_ID_ADPCM_IMA_WAV; | ||
ADPCMDecoder adpcm_decoder(id); | ||
ADPCMEncoder adpcm_encoder(id); | ||
WAVDecoder wav_decoder(adpcm_decoder, AudioFormat::ADPCM); | ||
WAVEncoder wav_encoder(adpcm_encoder, AudioFormat::ADPCM); | ||
EncodedAudioStream decoder(&out, &wav_decoder); | ||
EncodedAudioStream encoder(&decoder, &wav_encoder); | ||
StreamCopy copier(encoder, sound); | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
AudioLogger::instance().begin(Serial, AudioLogger::Warning); | ||
|
||
// start Output | ||
auto cfgi = out.defaultConfig(TX_MODE); | ||
cfgi.copyFrom(info); | ||
out.begin(cfgi); | ||
|
||
// Setup sine wave | ||
auto cfgs = sineWave.defaultConfig(); | ||
cfgs.copyFrom(info); | ||
sineWave.begin(info, N_B4); | ||
|
||
// start decoder | ||
decoder.begin(info); | ||
|
||
// start encoder | ||
encoder.begin(info); | ||
} | ||
|
||
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
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
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