diff --git a/components/st3m/st3m_media.c b/components/st3m/st3m_media.c
index 7e6dd86c572cd9f9638e37a6f950152c16bae476..8d12c01de5e0919f9f5d7bd590dd791446e8eccf 100644
--- a/components/st3m/st3m_media.c
+++ b/components/st3m/st3m_media.c
@@ -14,7 +14,7 @@ static st3m_media *audio_media = NULL;
 // XXX should be refactored to either be temporary SPIRAM allocation
 // or a static shared global pcm queuing API
 //
-static int16_t audio_buffer[AUDIO_BUF_SIZE];
+static int16_t *audio_buffer = NULL;
 
 void st3m_media_audio_out(int16_t *rx, int16_t *tx, uint16_t len) {
     if (!audio_media) return;
@@ -40,6 +40,11 @@ void st3m_media_stop(void) {
     if (audio_media && audio_media->destroy) audio_media->destroy(audio_media);
     audio_media = 0;
     st3m_audio_set_player_function(st3m_audio_player_function_dummy);
+    if (audio_buffer)
+    {
+      free (audio_buffer);
+      audio_buffer = NULL;
+    }
 }
 
 void st3m_media_pause(void) {
@@ -111,6 +116,7 @@ st3m_media *st3m_media_load_mod(const char *path);
 st3m_media *st3m_media_load_mp3(const char *path);
 
 int st3m_media_load(const char *path) {
+
     if (strstr(path, ".mpg")) {
         st3m_media_stop();
         audio_media = st3m_media_load_mpg1(path);
@@ -124,6 +130,8 @@ int st3m_media_load(const char *path) {
 
     if (!audio_media) return 0;
 
+    if (!audio_buffer)
+      audio_buffer = heap_caps_malloc(AUDIO_BUF_SIZE * 2, MALLOC_CAP_DMA);
     st3m_audio_set_player_function(st3m_media_audio_out);
     audio_media->audio_buffer = audio_buffer;
     audio_media->audio_r = 0;