How to apply ParameterCondition to SingleSound via script in FMOD Studio?

I’m trying to automate the application of parameter conditions (ParameterCondition) to SingleSound modules using scripts in FMOD Studio.

What I’ve achieved so far:

Traversed all events, groupTracks, and SingleSounds.

Identified the audioFile.assetPath of each SingleSound and used that to detect the language (PT/ENG/ESP).

Found that SingleSound exposes methods like addParameterCondition(parameter, min, max) in the API (via dump()), but when I try to call them directly in a script I get TypeError: not a function.

What I’ve tried:

mod.addParameterCondition(param, 0, 0) → error TypeError: not a function.

Accessed studio._internal.extensions.addParameterCondition and attempted to call it with studio.runExtension:

studio.runExtension(
studio._internal.extensions.addParameterCondition,
[studio.project, mod, param, 0, 0]
);

but I’m still not sure if this is supported at runtime.

My question:
Is there a supported way to apply ParameterCondition to a SingleSound via the scripting API?
Or is this feature not exposed in the public API and only available through the UI?

Hi,
Thanks for sharing the code. I am not sure what mod is but the issue may be that the groupTracks.modules is an array so you have to specify which one you are trying to add the ParameterCondition to:

var event = studio.window.browserCurrent() // Make sure an event is currently selected with a single instrument in the first audio track
event.groupTracks[0].modules[0].addParameterCondition(triggerParam, 0.5, 1)

AddCondition

Hope this helps!

Hi!

Thanks for the answer! I should have explained better beforehand.
In my project, I have a p_language parameter with three conditions (0, 1, and 2) in discrete type.

Since I have many assets, I would like to implement these conditions with a script in the custom script function rather than in the FMOD terminal.

Is that possible?
I managed to see the structure of my project with a debug script, but I cannot apply it.

Thank you in advance.

Thanks for the info,

I made a script that will apply a parameter trigger to all single instruments:
ApplyParamtrigger.txt (3.9 KB)

Hope this helps!

Hi Connor,

Thanks a lot for your answer and for the script! I’ve just adjusted it to fit my project, and it works fine.

Thanks again!

1 Like