XT_I2S doesn't work (sounds are distorted/chopped)
ESP8266audio doesn't make it too easy to play different sound on a press of a button, though it works pretty good with a single PROGMEM audio.
I came across the slim variant made by "honey the codewitch" but got another obstacle right in front of me, my LOLIN D32 got no PSRAM/SPIFF option so I need to get the data from PROGMEM.
Is there a way to convert the types so I can do something like:
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
E (132) psram: PSRAM ID read error: 0xffffffff
E (1147) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1347:error: Corrupted dir pair at {0x0, 0x1}
E (1148) esp_littlefs: mount failed, (-84)
E (1150) esp_littlefs: Failed to initialize LittleFS
[ 1036][E][LittleFS.cpp:95] begin(): Mounting LittleFS failed! Error: -1
looks like that path would create even more obstacles
Please post a small, complete code without all the extraneous clutter (i2s_internal, htcw_button, sfx) and just demonstrates the problem with SPIFFS and / or LIttleFS.
#include <Arduino.h>
#include <SPIFFS.h>
#include <LittleFS.h>
File file;
void setup() {
delay(1000); // for the serial monitor to not skip the first output
if(!LittleFS.begin()){
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
Serial.begin(115200);
SPIFFS.begin(false);
file = SPIFFS.open("/demo.wav","rb");
if(!file) {
Serial.println("Could not open demo.wav file");
while(true);
}
}
void loop() {
}
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
E (1011) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1347:error: Corrupted dir pair at {0x0, 0x1}
E (1012) esp_littlefs: mount failed, (-84)
E (1015) esp_littlefs: Failed to initialize LittleFS
[ 1037][E][LittleFS.cpp:95] begin(): Mounting LittleFS failed! Error: -1
After getting rid of all references to SPIFFS, you can try
LittleFS.begin(true);
to get past the Corrupted dir pair error, which sounds like the volume is not formatted. Of course, once you format, the volume will be empty. So getting any files there is a separate issue.
As for your original question: yes, you should be able to treat an array of bytes in memory as a stream, just as a bunch of bytes from a file. One potential complication is that the file_stream type in this case looks like a custom one that is part of SFX, so it may require some tinkering to allow input streams in general. If you have exactly one WAV to play, it might be easier to convert that to program text and bake it into the firmware, as opposed to dealing with any kind of filesystem.
good question, I did the formatting with platformio but there were no parameters, it is a one button thing :-/
For the progmem way, yes I have 3 sounds actually, with my current setting I use them with XT-DAC and from PROGMEM but I'd prefer it to be I2S since the sound is way better and the hardware doesn't need any additional denoising.