miketeachman / micropython-esp32-i2s-examples

Usage and examples for I2S support on the ESP32 microcontroller
MIT License
145 stars 29 forks source link

example code record to flash lost? #15

Closed ClemensGruber closed 3 years ago

ClemensGruber commented 3 years ago

There was an example code record to flash instead of sd card in the code section. Is this lost by accident or was there a technical reason to delete this example? E.g. problems writing to flash while recording / performance issues ... ?

miketeachman commented 3 years ago

I removed the internal flash example because the WAV file download times from flash to PC are quite long. For example, using the Ampy tool a 5 second mono 16-bit WAV file (128 kB) takes about 30 seconds to download from the ESP32 to a PC. That made me wonder about the practicality of recording to internal flash for typical recording periods, which I assumed are much longer than 5 seconds.

But, I might be wrong about this - please let me know if recording audio to internal flash has value and I'll update and restore the example.

ClemensGruber commented 3 years ago

Ok, I see! I tested the flash recording example some month ago, I do not remeber the exact time but it was a bit longer. There may be some szenarios for recording audio and sending samples via WiFi / LTE to a server. So it could be conveniten to need no SD card for this task. And some maker will have an ESP on the desk and no SD card hardware, so this would be helpful also.

miketeachman commented 3 years ago

Hi @ClemensGruber I restored and improved the example showing how to record microphone samples to internal flash. Commit: https://github.com/miketeachman/micropython-esp32-i2s-examples/commit/544f9aafb0743959119f472e9032144df064ab2a While testing this example I had difficulty using the Ampy tool to download sample files longer than 2 seconds. Using the WebREPL I was able to download samples files with 10 second duration (sample rate = 8000 samples/s. Two weeks ago I was able to use Ampy to download WAV files of 5s duration - I don't know what is different today.

miketeachman commented 3 years ago

added example on storing samples to internal flash