This commit is contained in:
2026-02-12 21:00:02 -08:00
parent 77f8236347
commit 8bdbf227ca
1141 changed files with 1010880 additions and 2 deletions

View File

@@ -0,0 +1,7 @@
# Decoding a WAV file
In this example we decode a WAV file into RAW output and send it to the Serial output.
This example uses the preferred EncodedAudioStream class.
Complie with Partition Scheme Huge APP!

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
/**
* @file stream-memory_wav-serial.ino
* @author Phil Schatzmann
* @brief decode WAV strea
* @version 0.1
* @date 2021-01-24
*
* @copyright Copyright (c) 2021
*/
#include "AudioTools.h"
#include "knghtsng.h"
// MemoryStream -> EncodedAudioStream -> CsvOutput
MemoryStream wav(knghtsng_wav, knghtsng_wav_len);
CsvOutput<int16_t> out(Serial, 1); // ASCII stream
EncodedAudioStream enc(&out, new WAVDecoder());
StreamCopy copier(enc, wav); // copy in to out
void setup(){
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// update number of channels from wav file
enc.begin();
out.begin();
wav.begin();
}
void loop(){
if (wav) {
copier.copy();
} else {
auto info = enc.decoder().audioInfo();
LOGI("The audio rate from the wav file is %d", info.sample_rate);
LOGI("The channels from the wav file is %d", info.channels);
stop();
}
}