The ESP32 microcontroller has only a few hundred kilobytes of internal RAM. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB PSRAM where 4MB can be directly addressed.

More information how to use PSRAM in Arduino can be found here. The only thing to highlight is that PSRAM can not be allocated in global variables! This is quite unfortunate because I preferably like to do this, so that the compiler can inform about the total memory usage.

Many FAUST examples are using more RAM that is available on an ESP32. Therefore I have added PSRAM support to the FAUST integration. Here is an example how to use this.

Finally there is a more generic way that can be used e.g. if you want to use PSRAM with any library that is not under your control. You can call the following “magical” function:

#include "esp_heap_caps.h"

const int limit = 10000;

Then, when external memory is available and activated, the allocation strategy is to initially try
to satisfy smaller allocation requests with internal memory and larger requests
with external memory
. This sets the limit between the two.


Jaap Noordzij · 18. March 2024 at 11:35

The site you reference claims that it is not possible to use more than 4Mb PSRAM. However my Arduino Nano ESP32 claims to have 8 Mb and also reports this:

11:29:12.326 -> Total heap: 386844
11:29:12.326 -> Free heap: 355376
11:29:12.326 -> Total PSRAM: 8386295
11:29:12.326 -> Free PSRAM: 8386295

What would be the best way for me to test with your audio-tools whether it is actually being used ?
(unless you have already tested this yourself ?)

    pschatzmann · 18. March 2024 at 11:38

    I was running into problems and have deactivated this feature by default. You can reactivate it in the AudioConfig.h by uncommenting the #define USE_ALLOCATOR true line.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *