How do I use SidechainModulator in the script

How do I use SidechainModulator in the script.
Is it necessary to associate TransceiverEffect with SidechainModulator.
For example:
sidechainModulator.relationships.sidechains.add(transceiverEffect);
But catch to exception and say that transceiverEffect is not a sidechain.
Thank you for your help.

Hi,

You seem to have misunderstood the direction of the relationship between sidechainModulator, sidechain, and transceiverEffect. sidechainModulator is referenced by the target of the modulation, transceiverEffect.modulators. sidechainModulator.sidechains specifies which Sidechain is used for the modulation, in this case sidechain

sidechainModulator.relationships.sidechains.add() is essentially used to specify which Sidechain the modulator uses, and requires you to pass the Sidechain you’re using as an argument, not the target Transceiver.

So, for example, if I wanted to add a Sidechain modulation to a Transciever’s level, I can create my SidechainModulator on the Transceiver:

var sidechainModulator = transceiverEffect.addModulator("SidechainModulator", "level");

Then add the SidechainModulator as a target of the Sidechain:

sidechain.relationships.targets.add(sidechainModulator);

Or the opposite, as you’ve been doing, and add the Sidechain as a target of the SidechainModulator:

sidechainModulator.relationships.sidechains.add(sidechain);

Firstly, thank you very much for your help.
I am a blind programmer, and currently I have completed most of the accessibility of fmods, utilizing existing ui scripting functions and fully supporting NVDA screenreaders.
Therefore, there are some concepts that I did not understand through the tutorial and cannot directly operate in fmod studio.
What I am currently wondering is where the sidechain is, how I want to create it, or whether it already exists.
I want to dodge track from another track through the output of one track.
I’m very sorry, I can only use scripts to complete all of this. Because I am a visually impaired person.
I have written this script for over 4000 line and can basically complete fmod studio operations. However, there are some concepts such as snapshots that I am not very clear about, but this dodge function is what I want now. Thank you.

1 Like

Can you tell me how to create a Sidechain through a script. I have been studying for a long time, but there are still no results. thanks

Apologies for the delayed response!

A Sidechain is a treated as type of effect, and can be created in the same way other effects can be; that is, accessing the Effect Chain of a Track of a given Event or Bus, and using .addEffect("Sidechain"). This can be done from an Event by accessing a Track, such as a groupTrack or the `masterTrack, then accessing the Track’s Mixer Group, and then the MixerGroup’s Effect Chain - for example:

event.masterTrack.mixerGroup.effectChain.addEffect("Sidechain");
event.groupTracks[1].mixerGroup.effectChain.addEffect("Sidechain");

Likewise, for Buses, which already exist as MixerGroup objects, you can do the following:

bus.effectChain.addEffect("Sidechain")

Please feel free to let me know what you’re unclear about with regards to Snapshots so that I can help explain.

Thank you very much. Originally, addEffect was able to add Sidechain, but these were not mentioned in the document.
I have successfully added the sidechain to the SidechainModulator and controlled the volume through amount.
I added a Command Instrument through the script, and what I want to know is whether it can control the initial coordinates of the 3D Event and set its X, Y, and Z.
My idea is to create an event or something for an environment, and then the programmer can simply play this event and load the entire 3D environment.

As for the concept of snapshots, I don’t understand the scope of their control. Can they only control Mixer parameters, or can they start new events or trigger events at specified times.

Unfortunately this isn’t possible. Command Instruments can only do the following:

  • Start Events
  • Stop Events (with release behavior)
  • Stop Events immediately
  • Set Parameters
  • Increment Parameters

The intention is that an event’s 3D coordinates are set via the Studio API - they cannot be set by a Command Instrument. The closest you can get to what you want would be to set parameters that automate panning and gain to effectively spatialize the audio yourself.

Snapshots can only control Mixer properties (faders, effects, bus macro controls like pitch etc.) and global parameters. They cannot make use of instruments, or directly interact with events. It is possible for them to indirectly interact with event behaviors, for example by setting a global parameter that an event uses as a trigger condition or to automate properties.