Add WAV and PROGMEM example
This commit is contained in:
1 parent
2cf8fcef2a
commit
6466df23f3
4 files changed
+49938
-1
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#include <Arduino.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include "AudioFileSourceSPIFFS.h"
|
||||
#include "AudioGeneratorMP3.h"
|
||||
#include "AudioOutputI2SNoDAC.h"
|
||||
|
||||
// To run, set your ESP8266 build to 160MHz, and include a SPIFFS of 512KB or greater.
|
||||
// Use the "Tools->ESP8266 Sketch Data Upload" menu to write the MP3 to SPIFFS
|
||||
// Then upload the sketch normally.
|
||||
|
||||
AudioGeneratorMP3 *mp3;
|
||||
AudioFileSourceSPIFFS *file;
|
||||
AudioOutputI2SNoDAC *out;
|
||||
|
||||
void setup()
|
||||
{
|
||||
WiFi.forceSleepBegin();
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
SPIFFS.begin();
|
||||
file = new AudioFileSourceSPIFFS("/pno-cs.mp3");
|
||||
out = new AudioOutputI2SNoDAC();
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
mp3->begin(file, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (mp3->isRunning()) {
|
||||
if (!mp3->loop()) mp3->stop();
|
||||
} else {
|
||||
Serial.printf("MP3 done\n");
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user