Adding pitch shift automation curve through script

Hello FMOD community!

My current workflow requires auto-creating a lot of similar events. I wrote a script which automates most parts (instrument creation, bank / folder assignment, adding of preset FX, routing).

For the script to be perfect, I’d need to add a pitch automation to the event’s master pitch property. The automation curve is always the same, containing 3 automation points.

Is there any way that I could achieve this with scripting? If not directly through the studio scripting API I was thinking about manually adding the corresponding objects (automation points, automators, etc) to the corresponding event XML files.

If there’s no way to do this, an alternative would be to create a macro that allows to use the ‘paste property’ function on a range of selected events, rather than on only one at a time.

Hi,

This can definitely be done!

// Step 1: Retrieve the event or use the one you have created,
//     And its master track mixer
var event = studio.window.browserCurrent();
var mixerGroup = event.masterTrack.mixerGroup;

// Step 2: Create an automator for "pitch"
var automator = mixerGroup.addAutomator("pitch");

// Step 3: Add an automation curve, for now we will use the events timeline
var curve = automator.addAutomationCurve(event.timeline);

// Step 4: Add points to that curve
curve.addAutomationPoint(0.0, 0);     // 0s, 0 semitones
curve.addAutomationPoint(0.5, 12);    // 0.5s, +12 semitones
curve.addAutomationPoint(1.0, 0);     // 1.0s, back to 0

For an example of creating a parameter via script: FMOD-Organisation-scripts/NOM_CreateLabelParam.js at main · nightonmars/FMOD-Organisation-scripts · GitHub

Hope this helps!

2 Likes

Hi Connor, thanks so much, working perfectly!

1 Like

No worries! If there are any other scripts we can assist with please do not hesitate to ask!