Hey there, Metasounds experts I need help implementing a music system in my game. The music consists of several layers such as melody, harmony, bass, percussion, and an occasional filler layer. Each layer has its separate conditions and randomized behavior (hence the different patches), but they all start and end together. I call those layers the Main Rhythm of my music. You can see the whole diagram with the patches that constitute the main rhythm highlighted below.
In addition to the main rhythm, there’s another rhythm in my music with a slightly different set of conditions. I call this second rhythm the Break System or the Break Rhythm. The purpose of the Break System is to introduce occasional “breaks” into the music to prevent ear fatigue and repetition. I have highlighted the patches responsible for the Break System below.
The Break System has a chance of triggering AFTER the main rhythm is finished, and the chance gets higher and higher if the break is not triggered. Also, the length of the music in the Break rhythm is randomly chosen from 3 different values (0, 4 bars, or 8 bars).
What I’m trying to do is to play the Main rhythm, then play the Break rhythm (if its length is not 0), and then repeat the whole diagram. That means my Main rhythm needs to wait for the Break rhythm to finish so it can start again DEPENDING ON how long the Break rhythm was. And as I mentioned before, my Break rhythm is also triggered after my Main rhythm. This has created an interdependency between these two parts of my music which causes loops to happen (as you may already know, loops are not allowed in Metasounds flow graphs).
I have tried several different tricks to create a workaround for this issue such as using delays, and time variables. The latest method I tried was using Booleans, which you can see in the images above. However, all of them ended up causing a loop. I also tried using delayed variables, which solves the loop problem but creates another issue with synching the two rhythms and causes them to overlap sometimes.
Does anyone have an idea how to solve this? I would appreciate any tips or ideas I can get!
Also, feel free to ask any questions in case I didn’t explain things clearly enough