I have three loops. They represent the “base,” the “piano,” and the “kick” track. What I want to do is the following:
- The base track loops no matter what.
- The piano and the kick track join according to a discrete parameter. When the parameter is at 1 or above, and 2 or above, respectively.
- A crossfade should take place on transition. That fading must be in total sync with what is currently playing.
What I mean by the final point is as follows:
Suppose that the crossfade takes exactly a beat long. When the discrete parameter changes from 0 to 1, it causes the piano track to start playing. If the param change occurred at the 5th beat of the loop, the crossfade should occur so that the piano track fades in from the 5th beat and completes fading precisely at the 6th beat.
Right now, I have achieved something close to what I want by:
- Placing all the track on separate tracks and
- setting trigger conditions up for each instrument.
However, I can’t crossfade the instruments correctly. I tried the AHDSR, but that caused the instrument to fade in at every start of the loop. It seems that looping causes the instrument to retrigger. I want FMOD to ignore the attack portion at the beginning of the loop. Is this possible?
Screenshot of the event in question:
You can’t use AHDSR modulators for this, as they register any change in timeline playback position as a retrigger of an asynchronous instrument. That being said, there are other ways to achieve the behavior you want.
The simplest would be to use automation instead of modulators to control the volume of the affected tracks, and to assign seek speed to each such parameter in order to ensure a gradual ramping of volume instead of a sudden change. An example of this can be found in the “music/Level 02” event in the “examples.fspro” project included in every installation of FMOD Studio. If you want to ensure that crossfades only begin on specific beats and bars, you will need to ensure your game’s code only sets the value of the parameter on those specific beats and bars.
A more complex method is to use quantized relative transition regions with transition timelines. Transition timelines allow you to create custom fade curves that fade in or out specific tracks as you transition from one section of the timeline to another, setting a transition region to use relative transitions ensure that the playback position transitions to the same position relative to the target destination region that it left relative to the transition region, and quantizing the transition region ensures that the transition only occurs on specific bars and beats. This method will, of course, require you to lay out each alternative version of your content on a different section of the timeline, making it a more time-consuming effort.
Thanks for the info and pointing to the example.
Here’s what I ended up doing in case anybody runs into a similar situation:
I changed the structure of the event in question so that…
- everything plays at once
- the parameter has been changed from discrete to continuous (but the game still sets discrete value)
- set the seek speed for the parameter to allow fade in/out using automation.
This seems to work fine, and it also seems that I don’t have to care about syncing the transition because it sounds good enough (I also realized you can actually set seek speed to sync the fading speed, so that’s another way albeit without start-point sync)