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,5 @@
# Decoding a MP3 file with Metadata
In this example we provide the ID3 metadata from a MP3 file. We support the old ID3V1 and the newer ID3V2.
The MetaDataID3 class is used as stream output destination.
You register your callback method with setCallback().

View File

@@ -0,0 +1,41 @@
/**
* @file streams-memory_mp3-metadata.ino
* @brief In this example we provide the metadata from a MP3 file.
* @author Phil Schatzmann
* @copyright GPLv3
*/
#include "AudioTools.h"
#include "sample-12s.h"
MemoryStream mp3(sample_12s_mp3, sample_12s_mp3_len);
MetaDataOutput out;
StreamCopy copier(out, mp3); // copy in to out
// callback for meta data
void printMetaData(MetaDataType type, const char* str, int len){
Serial.print("==> ");
Serial.print(toStr(type));
Serial.print(": ");
Serial.println(str);
}
void setup(){
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
mp3.begin();
out.setCallback(printMetaData);
out.begin();
}
void loop(){
if (mp3) {
copier.copy();
} else {
stop();
}
}