Add Opus file format (and OGG demux) (#294)
Add ported versions of the Opus codec, OpusFile parser, and OGG demuxer from Xiph.org. Only works on the ESP32 due to memory limitations (of opusfile, strangely enough, and not because of opus compression). Adds a basic example and a host test. Fixes #278
This commit is contained in:
1 parent
7c379748b1
commit
fae26d4010
278 files changed
+63024
-3
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#include <Arduino.h>
|
||||
#ifdef ESP32
|
||||
#include <WiFi.h>
|
||||
#include "SPIFFS.h"
|
||||
#else
|
||||
#include <ESP8266WiFi.h>
|
||||
#endif
|
||||
#include "AudioFileSourceSPIFFS.h"
|
||||
#include "AudioGeneratorOpus.h"
|
||||
#include "AudioOutputI2S.h"
|
||||
|
||||
// The includes OPUS file is from Kevin MacLeod (incompetech.com), Licensed under Creative Commons: By Attribution 3.0, http://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
AudioGeneratorOpus *opus;
|
||||
AudioFileSourceSPIFFS *file;
|
||||
AudioOutputI2S *out;
|
||||
|
||||
void setup()
|
||||
{
|
||||
WiFi.mode(WIFI_OFF);
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
SPIFFS.begin();
|
||||
Serial.printf("Sample Opus playback begins...\n");
|
||||
|
||||
audioLogger = &Serial;
|
||||
file = new AudioFileSourceSPIFFS("/gs-16b-2c-44100hz.opus");
|
||||
out = new AudioOutputI2S();
|
||||
opus = new AudioGeneratorOpus();
|
||||
opus->begin(file, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (opus->isRunning()) {
|
||||
if (!opus->loop()) opus->stop();
|
||||
} else {
|
||||
Serial.printf("Opus done\n");
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user