Music drags / lags while loading things

In my game, a player can go between rooms, and as they do it, the room is dynamically populated before they move into it.

As they go through, there is an AudioSource playing background music. It has a weird lag effect as the player goes into the other room, almost like a doppler effect or if I were to reduce pitch and play speed in the sound for half a second or so.

Is there a way to buffer the sound or something so this doesn’t happen? I’m using Object.Instantiate on prefabs that are already loaded to create all the assets, and I’m only creating maybe 100. Doesn’t seem like that should fuck up the sound.

Welp, I figured it out. Turns out that going between rooms causes the camera to move, and the prefab with the sound in it doesn’t move. Even though I have a massive falloff for my AudioSource, it still was causing a doppler effect from this movement. I fixed it with:

    //no doppler effects for music
    GetComponent<AudioSource>().dopplerLevel = 0.0f;
    
    //no spatial blend either
    GetComponent<AudioSource>().spatialBlend = 0.0f;

This is a good thing to do for music controllers. You don’t want doppler effects and crap with those things unless it’s coming from a source in the environment.