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

**URL:** <https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222>\
**Category:** FMOD Studio\
**Tags:** javascript\
**Created:** [September 1, 2022, 4:28am UTC](https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222 "2022-09-01T04:28:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T-Bot](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@T-Bot](https://qa.fmod.com/u/T-Bot)\
**Post date:** [September 1, 2022, 4:28am UTC](https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222/1 "2022-09-01T04:28:25Z")

</div>

Hello,

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?

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 8, 2022, 2:39am UTC](https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222/2 "2022-09-08T02:39:42Z")

</div>

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:

```javascript
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.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [October 18, 2022, 12:58am UTC](https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222/3 "2022-10-18T00:58:01Z")

</div>

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:

```javascript
var sound = "C:/path/to/jaguar.wav";
var event = studio.project.create("Event");
event.name = "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);
multisound.relationships.sounds.add(subsound);

```

---

<div class="post-metadata">

**Author:** ![T-Bot](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@T-Bot](https://qa.fmod.com/u/T-Bot)\
**Post date:** [October 18, 2022, 1:49am UTC](https://qa.fmod.com/t/fmod-scripting-adding-instruments-and-audio-assets-to-a-multi-instrument/19222/4 "2022-10-18T01:49:18Z")

</div>

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

> multisound.relationships.sounds.add(subsound)

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.
