I'm in the process of designing some dynamic music systems for SC2 maps.
However, I've hit a bit of a problem with audio synchronisation, and would really appreciate it if a few people would help me test something.
The system I'm currently working on is based on using a piece of music that is split into multiple layers, for example, the different instruments in a band or sections of an orchestra. The volume of each layer is then controlled by specific game parameters tied to that layer; the health of a base, proximity of enemies or the amount of resources collected for example.
In order to stay synchronised all the layers are started together and remain playing even when their volume is turned down. The problem I've found however is that when a layer's volume is set to 0% it will sometimes lose sync. I've experimented with setting the volume to very small percentages (small enough not to be heard) and this seems to somewhat solve the problem. However, the specific percentage volume I have to use seems to be different depending on the particular music used. This leads me to believe that the music might be losing sync when it drops below a certain dB threshold. Maybe the audio engine de-prioritises sound that it thinks is inaudible?
If anyone has a spare 5 minutes to test out the two maps that I have attached, to see if they get the same results as me, I would be very grateful. They are two versions of the same level, in one the volume gets turned down to 0%, in the other it gets turned down to 0.3%.
In the level you'll see a play button that will start a drum loop (I know, it's very very boring but I wanted to make it simple so the synchronisation would be obvious). Press the Snare button to turn it off, leave it for a bit, turn it on again, leave it again etc. Just generally try to mess up the sync by turning it on and off. Now if you could possibly do the same again for the second level.
Hopefully you'll get the same results as me, with AudioSyncTest_01 going out of sync, and AudioSyncTest_02 staying in sync.
Thanks to both of you for testing this, at least it's good to know it's not just a problem on my end. I'll have another look to see if there's a flag in the data entry that might fix it. Maybe assigning the sounds to a different sound channel other than "music" might be worth a shot as well. I guess FX, dialogue etc could be prioritised over music and might not have the same problem.
Also, once I've got this sorted I'm going to be releasing the music systems I've been working on, hopefully in the near future. And I'd love to get some feedback from anyone interested.
I already implemented a random music generator using layers a couple of years ago (for crush company), however I encountered the same desync issue and I removed that feature.
If you are able to do a workaround just let me know ;)
That's cool to know that you've tried something similar.
A kind of work around is to have the volumes of the layer, (when they're "off") set to a a very small percentage. As long as there's another layer playing or the level ambience, the other layers shouldn't really be audible. There is a slight problem with higher pitch sounds however, which tend to cut through everything else even at low volumes. But this can be pretty much solved by applying a low pass filter to the entire music sound channel when none of the layers are "on". I think that DSP effects were enabled with HOTS? I hadn't seen the option up until recently.
Until I find a proper solution this method will have to do.