Adding a Snapshot Module to grouptrack via FMOD Studio Scripting API

I’m getting validation errors when trying to add a snapshot module to a group track via script. Ideally would love to just have a snapshot on a hotkey to add wherever I need it instead of copy-pasting, especially since there’s 3 or 4 different ones I need to apply quickly in different situations.

It seems that the normal [Grouptrack].addSound() doesn’t work with snapshot instruments, so I’ve been trying to do something like this:

            var snptrack = newevent.addGroupTrack("Snapshot");
            var snapshotInst = studio.project.create("SnapshotModule");

I’ve also tried doing it with snptrack.event.timeline.relationships.modules.add() but both don’t seem to work. The return is TRUE but the instrument is not visible and FMOD will want to validate the project, after which it removes the relationships but the Snapshot Instrument I created still exists in the abstract.

What is required to create a valid Snapshot Module? I tried giving it a length and start time as well, but that doesn’t validate the object. Or where does it want to be attached?


You were super close! Here is one way to add a snapshot module:

var snap = studio.project.create("Snapshot"); = "MySnapshot"

var evt = studio.project.create("Event"); = "MyEvent"

var inst = studio.project.create("SnapshotModule");
inst.event = snap
inst.audioTrack = evt.masterTrack
inst.parameter = evt.timeline

You can substitute creating an new snapshot and event with ones already present in your project.

Hope this helps!

Thanks so much! I was able to make this with your help:

1 Like

No worries!

That is an awesome tool! If you have any more scripting questions please let me know!