Open rupraph opened 1 week ago
Did you try with the provided example that is using the wav in the resource directory ?
I think your example files are wrong: a length of 0 does not give you much!
Thanks. I just downloaded these files to confirm werther this could be related to the files, and the result is unfortunately the same, the loaded sample still reports a len of 0 (just tried with snare.wav which you also mention in your reference exemple, and blip.wav)
Which is weird. I can list the content of the SD, but when loading the samples, something goes wrong.
Would you have any lead on what could cause this ? I don't really know where to start here.
Did you try a test sketch that confirms that reading of the file is working ?
I only tested I can access the SD, by listing all files in the SD. Also, the correct sample rate and audio resolution is calculated by the sample summury function, which makes me think the file is correctly accessed ?
If I remember right the functionality uses the ESP32 virtual file system and the related c file API.
So I would not take any assumptions and test if you can open and read the file with fopen and fread. I never used this functionality (except for the provided example) since I usually prefer to provide the sound data in PROGMEM.
Maybe you should also check if beats.load() returns true
Thanks for the directions ! So I can confirm the file can be accessed and red by the sd_mmc library. I could print the content with the reference exemple. However the maximilian sample.load("/xxx.wav") function return 0
I noted maximilian is using :
ifstream inFile( myPath.c_str(), ios::in | ios::binary); result = inFile.is_open();
While the sd_mmc file system uses:
File file = fs.open(path);' then 'file.read()
I am not really familiar with filesystem stuff, but I guess I might not be in the right config to use ifstream ?
hmm: try to make a read test using ifstream
The constructor should open the file and the check if it is open (is_open()) should then return true...
Just noticed that you forgot the prefix to specify the file system: use beats.load("/sdcard/xxx.wav");
when the file is in the root directory of the drive that you named /sdcard
Just noticed that you forgot the prefix to specify the file system: use beats.load("/sdcard/xxx.wav");
when the file is in the root directory of the drive that you named /sdcard
Actually this prefix was in my initial issue code. But yes, I'll test ifstream alone first and see.
Problem Description
Description: I cannot manage to read a sample from SD with maximilian. Acces to SD seems ok, but maximilian won't load it's content. When printing the summury info, charactics are there, but content remains at zero. So of course it is not playing.
I do the following for loading: sample1.load("/sdcard/pong.wav"); Serial.println(sample1.getSummary().c_str());
See serial output below: Loading: ### /sdcard/pong.wav Ch: 1, len: 0 Format: 1 Channels: 1 SampleRate: 11025 ByteRate: 11025 BlockAlign: 1 BitsPerSample: 8 Length: 0
I tried with different samples (mono). I tried short to very short samples, like 2kb to 60kb, which I would expect to work without any issue, not matter if I use PSRAM ?
I checked a bit how the load function works but can't find what is going wrong. The data seems to be red, but the last manipulation which manipulate the chunks to the "amplitude" variable which seems to be the final data to be played is not filled.
Issue might be esp32 related ? or am I missing some constraints on the sample type/format ? :
Device Description
Esp32-s3 N8R8 devkitC
Sketch
Other Steps to Reproduce
No response
What is your development environment
PlatformIO, but the example above was also tested to have the issue with arduino IDE
I have checked existing issues, discussions and online documentation