From a game audio perspective
The main starting point was to write music that would loop indefinitely, without getting boring...
After some research + much trial and error, I found that a few short sections, with multiple variations on each worked best!
I wrote some custom C# scripts that could automate section changes for each track. However, I decided to use Wwise for testing out this idea as an implementation within Unity.
Integration notes
Implementation was considered before writing the music.
Considered the use of Wwise for it's greater flexibility.
Special attention given to the starts and ends of each section for each track and their variants, for smoother transitions.
Extensively tested most important ideas in Unity game engine.
Part 1: Distance attenuation (tested in Unity & Wwise for track 1: Tav Sav)
Ground floor, tavern
The above screenshot (fig.1) shows the prototype setup I built for testing my 'tavern-esque' music in an indoor space. The game objects shown in the diagram (Portal, Emitter and Room) correspond to 3 commonly used Wwise scripts; AK Room, AK Emitter and AK Portal.
The screenshot below (fig.2) taken from Wwise shows the attenuation settings I used, in conjunction with the above mentioned scripts. The results were quick and acceptable, after some light tweaking.
Top floor, tavern
I decided on a ray-casting based script for handling the distance attenuation and occlusion upstairs. The screenshot below (fig.3) shows the relevant script for this behavior.
Moreover, I have also included a screenshot (fig.4) showing one of the more unusual RTPC assignments to a Harmonizer plugin!
The settings for the DSP in the screenshot above (fig.4) were set so that as the 'Wet Level' increases, it thickens up frequencies in the low-mid range. Combining this effect with a low pass filter and some volume attenuation gave me the sound I was looking for.
Overall, I felt the result was more interesting than using another portal, though it does require more resources.
--------
Part 2: Random music (tested in Unity & Wwise, across all tracks)
FC Pirate Music Player
The download link above (fig.5) is for a simple music player I built in Unity and Wwise. It was used in many iterations for testing all of the tracks and core implementation ideas for this project.
Over to the Wwise, control the random
All audio files were housed in Wwise random containers or music segment containers (fig.6). Moreover, I tweaked the randomization settings as required.
The next step was to edit/remove potential clashes and control the volume level of the mix bus. For this, I used a combination of side-chaining and also the 'Polyspectral' Multi-Band Compressor.
Additionally I removed some low end on the busier tracks, then added it back in using the 'Harmonizer' plugin. It is important to note that this was a done to neaten up low end at the group level, affecting the entire mix with one plugin instance.
For a closer look at the routing structure, there is a screenshot profiler readout (fig.7) for track 2: 'Battle Royale', shown below.
Final notes
While I enjoyed the dynamic effect of distance attenuation and spatialization for the tavern music, it was only really appropriate in scenarios where music was to be heard by the player as a live performance.
However, this variation in panning and volume was important for making the tavern music listenable over longer periods. I wanted this extra layer of dynamics for all the music I'd written!
My preferred solution was assigning LFO curves to voice volumes. This was done with individual tracks and for the entire mix bus, before any compression was applied. Most of the volume changes were very subtle, though it was enough to create some dynamic variation that wasn't otherwise present in the raw audio files!