Playing Audio (wav file) from PSRAM buffer (instead from SD card) ? #1077
Replies: 2 comments
-
Hi Kalo, Placing your audio file in the PSRAM is unfavourable. It will only be there as long as the power supply is switched on. Better use the flash. For example, if you have 16MB and reserve 4MB for your project, you have 12MB for your audio files. A compressed audio format would be better than wav. |
Beta Was this translation helpful? Give feedback.
-
Hi Wolle @schreibfaul1 ;)
that's exactly what i meant, i will use PSRAM in future only, Also won''t add any SD card any longer
i do not need to store /remind any audio files. I use exactly one global var ( .. PSRAM_BUFFER = (uint8_t*) ps_malloc( .. e.g. half of The funny thing is: I am pretty sure your AUDIO.H has an malloced array too for the audio chunks right ? .. so it sounds a bit strange (workaround) if we shift data from left to right,, then right to left .. as both sides do not need a 'file'. And what is funny too: I am pretty sure a kind of
Yes, you are right .. but I am in the good situation that no encoder/decoder is needed .. my recording function is storing the microphone I2S stream 1:1 into my buffer, so i just append (on begin) a wav header myself, then sending data 1:1 to TTS (TextToSpeech) server. Most fastest solution, most reliable (just need still the 'file' workaraund in case i want to listen my own recorded audio in speaker e.g. for debugging, via audio.connecttoFS( SD, "\audio.wav" also in case i ever add a own TTS with audio data response). Long story short: I can test the FFAT idea, thanks for the idea Wolle ! But thanks for your help for now .. maybe i will test this workaround (with virtual files in FLASH) using FFAT once .. and compare to a (self made solution maybe) in streaming my binary data to I2S speaker directly (having MAX98357 on my circuits), I don't know yet what is best ;) thanks for the moment 😊 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Wolle @schreibfaul1,
just posting here, as it is not an issue/bug, its more a question to your future roadmap.
Background: Meanwhile i learned from you that it's best idea to focus on ESP32 with PSRAM in future 😁 .. so in my project i coded (myself) functions
But here my question: Meanwhile it makes not much sense any longer to play my audio from SD card only (neither own recorded audio, neither audio from TTS server) as i want to get rid of any SD card at all (having only PSRAM instead). So the current function
audio.connecttoFS( SD, "\audio.wav")
does not help any longer. (Detail: i do not want to use any SPIFFS or FATFS, those workarounds are by far too slow and not reliable for web socket steaming .. also having my bit&bytes already as 'wav file' in PSRAM ;)I am searching for an option to play any WAV (which is stored in PSRAM incl. proper wav header) .. instead file from SD., let's say a kind of
audio.connecttobuffer( uint8_t* PSRAM_BUFFER, size_t length)
. Would also perfectly match to your 'audio.connecttohost(url)' and 'audio.openai_speech()' - i am using both daily 😉).my Q: Do you plan anything similar next ? / or any idea how to play audio (stored in RAM) - using AUDIO.H - to I2S output ?
If not, do I have to reinvent the wheel by myself (similar as i did with recording audio via I2S mirophone) ? Would be a pity, because I still use (and want to use further) you great AUDIO.H for audio output.
Thank you in prepare for feedback .. or any idea/workaround (how to solve today) ;)
kalo
Beta Was this translation helpful? Give feedback.
All reactions