FMOD Scripting - Adding instruments and audio assets to a multi instrument


I’m trying to streamline my process for importing large groups of files. I’ve gotten to the point where I am able to create an event and add a multi-instrument to that event but I can’t work out how to add single instruments to the multi-instrument without creating a mess on the timeline.
I also have no problem adding a single instrument and then adding an audio asset to that instrument.

Is there a direct way to add both the single instrument and the audio asset to a multi instrument created on a group track?
Or do I need to create each single instrument first and then definite it’s owner singleIntrument.owner = multiInstrument ? If so is there a clean way to create the single instruments first without having to add them to a group track?

If you change the parameter argument in track.addSound to something other than event.timeline that should prevent the sound from displaying in the timeline e.g:

track.addSound({}, 'SingleSound', 0, 10).owner = multiInstrument
multiInstrument.sounds[0].audioFile = studio.project.importAudioFile("C:/Bass.wav");

That said, I am finding that the Multi Instrument won’t playback Instruments created and assigned to it in this way, which seems to be a bug. I have passed this along to the Dev team to investigate in more detail.

After some discussion with the Dev team, I have found that this correctly allows a sound to be created inside a multi-instrument without intefering with the timeline:

var sound = "C:/path/to/jaguar.wav";
var event = studio.project.create("Event"); = "New Event";
var track = event.addGroupTrack();
var multisound = track.addSound(event.timeline, 'MultiSound', 0, 10);
var subsound = studio.project.create('SingleSound');
subsound.owner = multisound;
multisound.sounds[0].audioFile = studio.project.importAudioFile(sound);

Thanks Jeff.
I actually managed to work this out by trial and error. The only difference I have is that I don’t use the


and I add the audio to the subsound before making it’s owner the multisound. Everything has been working fine for me and the sounds all show up in the multisound container.

1 Like