My attempt at a dynamic music system

30 views
Skip to first unread message

bo samson

unread,
Feb 2, 2021, 9:57:06 PM2/2/21
to SoLoud audio engine
Hi all, I've started a small hobby game project and am using SoLoud for audio.

I've made a simple system for dynamic music. Has anyone attempted anything similar before, and is there a smarter way to do it than this?

Here's my setup: I've got one parameter deciding which segment of music will loop, and another that fades/mixes some of voices playing. (for example, to fade out a drum track to replace it with another)
The data:
  • many sections
    • each section is made of several loops playing at once, all the same length
  • a voice group
The logic:
  • from time to time, I check the stream position, and if it's about to end (and I need to change section),
    • I tell the group (all of the currently playing loops) to stop looping
    • I playClocked all the loops of the new segment (delay is length of the loop - position), set them looping and add to the group
    • ..and fade their volumes
  • otherwise, I just fade the loops' volumes
It seems to be doing the trick, but I've heard some popping at times. I could write myself some kind of visual debugger, but I figured that, hey, maybe I've been uselessly reinventing the wheel?

@Jari : I've recently seen you've done some kind of similar thing in the tAAt 2021 demo, with a whole lot of busses and queues. Would it be a better way? I was thinking of using queues at first, like queueing voice groups or busses (only to realize one cannot queue those). The way I see it, the series of parallel queues (as in the demo), seems inefficient, especially with a variable amount of loops (I'd need the max amount to be running at all time, with dummy silent loops or volume at 0). 

All that being said, I know nothing of the internals so my doubts may not be founded.
Thanks!
Reply all
Reply to author
Forward
0 new messages