I have a set of five sounds (beeps) that I want to play in order, ascending and descending based on a discrete parameter named ‘Remaining Inputs’ with a range of 0 - 5. When there are certain number of remaining inputs, the beep played should correspond to that number i.e. with 3 inputs left the 3rd beep in order should play. Here’s how I’ve currently set this up:
I initially tried creating a seperate even with an Action Sheet using a command instrument to increment the parameter and an event instrument to play the sound like so:
This didn’t work as expected, however, as the sounds seem to double up. Using a command instrument seems to be the way to go, but maybe I’m missing something?
I’ve also tried placing the common instrument inside the event where the sounds are played. It actually does properly increment/decrement, but plays both the current sound and next sound at the same time.
The reason for the “doubling up” that you’re noticing is that two different single instruments are being triggered, because the parameter has two different values within the lifespan of the event instance that contains and triggers the single instruments: It starts with one value, which triggers one single instrument that begins playing, then changes to another value, triggering a second single instrument that begins playing as well. When the command instrument is located within the same event instance as the single instruments, this parameter value change happens because the parameter triggers both the first single instrument and and the command instrument at the same time; whereas when the command instrument is in an action sheet followed by an event instrument, the asynchronous execution of command instrument commands ensures that the parameter value’s change is delayed until after the event instrument has begun playing.
To prevent this doubling up from occurring, you must ensure that the value of the parameter does not change within the event instance that contains the single instruments after that event instance is started; or alternatively, you must ensure that the single instruments cannot be triggered by parameter value changes after the start of the event instance.
The tool for this is the “Hold value during playback” setting of parameters, which prevents a parameter instance’s value from being changed by outside forces while that parameter instance exists. Enabling this setting on a global parameter is not useful, as doing so prevents the parameter’s value from being adjusted at all, but enabling it for a local parameter ensures that the parameter’s value cannot change within that event instance while it is playing.
The solution, therefore, is to create an event very similar to the action sheet event you have already made, but to replace the referenced event’s global parameter with a local parameter; then, in the parent event, automate the local parameter on the global parameter such that the local parameter’s value always mates that of the global parameter. This will ensure that when the command instrument changes the value of the global parameter, that change will affect new instances of the referenced event that are created subsequently, but will not be propagated to existing instances of the referenced event that are already playing.