USBAudio output drops in quality then goes back to normal in a set pattern

Hi everyone, I have a STM32F746NG-Discovery board and I made a small program that pipes PC audio from USB (using USBAudio.h) to the board’s built-in audio codec (WM8994). It works for the most part, but the audio quality fluctuates in a set pattern. For the first 30 seconds of being turned on, the audio sounds fine, but after 30 seconds the quality plummets exponentially for 15 seconds, only to exponentially go back to normal audio quality. It keeps repeating this pattern until the board is turned off.

I’m suspecting it’s something to do with the audio buffer, but I’ve only been messing with this board & mbed for roughly 2 weeks now, so I’m kind of lost here on how to prevent the fluctuating audio quality.
Here’s what my code looks like:

#include "mbed.h"
#include "stm32746g_discovery_audio.h"
#include "stm32746g_discovery_sdram.h"
#include "USBAudio.h"
#include <cstdint>
#include <cstdio>

#define AUDIO_BLOCK_SIZE   ((uint32_t)512)
#define AUDIO_BUFFER_IN     SDRAM_DEVICE_ADDR

// main() runs in its own thread in the OS
int main()
{
    //init USBAudio 
    USBAudio audio(true,48000,2,8000,1,10);

    //init sdram buffer
    BSP_SDRAM_Init();
    memset((uint16_t *) AUDIO_BUFFER_IN, 0, AUDIO_BLOCK_SIZE);
   
    //init BSP audio
    BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_HEADPHONE, 100, 48000);
    BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02);
    
    BSP_AUDIO_OUT_Play((uint16_t *)AUDIO_BUFFER_IN, AUDIO_BLOCK_SIZE);
    while (1) {
        
        if (!audio.read((uint8_t *)AUDIO_BUFFER_IN,AUDIO_BLOCK_SIZE)) {
            memset((uint16_t *) AUDIO_BUFFER_IN, 0, AUDIO_BLOCK_SIZE * 2);
        }  
        
    }
}