schreibfaul1 / ESP32-audioI2S

Play mp3 files from SD via I2S
GNU General Public License v3.0
1.12k stars 288 forks source link

Does not play local mp3 from FS (SPIFFS) #863

Open selimovur opened 3 weeks ago

selimovur commented 3 weeks ago

I try to play local and remote files in my project, it works fine when play with "connecttohost" however it does not play a simple mp3 file from spiffs even though it returns true while connecting to the file. So help pls...

Explorerlowi commented 3 weeks ago

You should use connecttoFS to play mp3 files in spiffs

selimovur commented 3 weeks ago

You should use connecttoFS to play mp3 files in spiffs

Thanks for your reply, but I'm already calling it before calling audio.loop function.

selimovur commented 3 weeks ago

pragma once

include "Audio.h"

include

Audio audio;

define BUTTON_PIN 27

define SD_CS 4

const char ssid = "??"; const char password = "??";

void setup() { Serial.begin(115200); delay(1000);

SPIFFS.begin(true);

Serial.println("Connecting to wifi..."); WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); }

Serial.println("Connected.."); Serial.print("IP Adress: "); Serial.println(WiFi.localIP());

pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH);

audio.setPinout(17, 18, 16); audio.setVolume(21);

if(SPIFFS.exists("/open_sound.mp3")){ Serial.println("File is existing"); Serial.println(audio.connecttoFS(SPIFFS, "/open_sound.mp3")); } else { Serial.println("File does not exist"); } }

void loop() { audio.loop(); }

selimovur commented 3 weeks ago

The file does exist and audioconnecttoFS returns 1 but not playing, when i try the same example with audioconnecttohost, it does work..

lostkk2024 commented 1 week ago

Hello, sir. I am experiencing the same issue. May I ask if you have resolved this issue?

schreibfaul1 commented 1 week ago

This library does not recognise SPIFFS, SD_MMC or FFat. These are file system objects that are transferred. If you put a short text file into SPIFFS and then open it, is the text fully readable?

selimovur commented 1 week ago

Yes I solved the issue, it was about the partition scheme usage due to an arduino ide bug. Once I cleared the flash memory and write the same file again with the correct partition scheme and upload a small sketch into the esp32, it started working. Thanx...

lostkk2024 commented 1 week ago

Thank you for your replies. After switching the file system to LittleFS, everything is working fine now.