Randomize multi instrument Pitch in multiple Event

Hello,
Everything is on the title.
In our game, we have thousand of event that were imported through a batch, so we need to randomize many of them but we can’t do it at once.
We have to select each one of them and randomize it.
Is there any script that exist to do it ? Maybe a new features a come in fmod ?

Thanks ind advance for your answer :slight_smile:

If you want to apply random modulation to the same property across multiple events, ensure that “Bulk Edit with Multi-Selection” is enabled in the View menu, then select all events you want to edit, right click on a pitch property (if it’s highlighted in gold, that means it can be bulk-edited), and selection Add Modulation → Random.

If you want to set the value of a pitch property to a random value across multiple events, not modulate it, you’ll need to use the Studio Scripting API. This would likely involve the following steps:

  • Get an list of all event in your project with studio.project.model.Event.findInstances() and iterate over them
  • Get the instrument with the pitch property you want to randomize. This involves checking instruments in an event’s:
    • Timeline ( event.timeline.modules)
    • Parameter sheets (event.parameters[i].modules)
    • Action sheets (event.parameter[i].modules.sounds)
  • To distinguish between parameter sheet and action sheets, you need to check whether modules is an array with Array.isArray(parameter.modules) - if true, the sheet is a parameter sheet, not an action sheet
  • If a pitch property exists on a given instrument, you can then set it to a value between -24.0 and 24.0

I would recommend taking a look at the “scripts” folder in your FMOD Studio install location for examples of the structure scripts use.