# Creating a multi-instrument in an action

**URL:** <https://qa.fmod.com/t/creating-a-multi-instrument-in-an-action/20588>\
**Category:** FMOD Studio\
**Tags:** javascript\
**Created:** [August 24, 2023, 3:39am UTC](https://qa.fmod.com/t/creating-a-multi-instrument-in-an-action/20588 "2023-08-24T03:39:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpeddicord](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mpeddicord/32/5487_2.png) [@mpeddicord](https://qa.fmod.com/u/mpeddicord)\
**Post date:** [August 24, 2023, 3:39am UTC](https://qa.fmod.com/t/creating-a-multi-instrument-in-an-action/20588/1 "2023-08-24T03:39:49Z")

</div>

Hello,

I’m trying to import my game’s previous assets into fmod. I have the following code working to import my sounds into a multi-instrument inside of a timeline. But my audio engineer said they should be in an action sheet.

How might I change this code to create a multi-instrument into an action sheet instead?

```auto
for(i = 0; i < data.length; i++){
			console.log("Creating Event: " + data[i].name);
			
			var category = data[i].audioSourceTemplateName.replace("Assets/Audio/SFX/", "").replace(".prefab", "");
			
			folder = studio.project.create("EventFolder");
			folder.name = category;
			
			event = studio.project.create("Event");
			event.name = data[i].name;
			event.folder = folder;
			
			var track = event.masterTrack;
			var multiInstrument = track.addSound(event.timeline, 'MultiSound', 0, 10);
			
			var sounds = data[i].sfxGroupNames;
			for(h = 0; h < sounds.length; h++){	
				var assetNameFixed = sounds[h].substring(7);
				console.log("\t Importing " + assetNameFixed);
				audioFile = studio.project.importAudioFile(assetNameFixed);
				
				var sound = studio.project.create(assetNameFixed);
				sound.audioFile = audioFile;
				sound.owner = multiInstrument;
			}
		}

```

Extra points if you can tell me why it seem the script created a timeline in a new event by default whereas the GUI doesn’t?

Thanks alot!

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [August 28, 2023, 1:42am UTC](https://qa.fmod.com/t/creating-a-multi-instrument-in-an-action/20588/2 "2023-08-28T01:42:56Z")

</div>

Hi,

~~Unfortunately, adding action sheets to events via the Studio Scripting API is currently bugged. I’ve noted this on our feature/improvement tracker.~~

My mistake, it’s not bugged - you can create an ActionSheet via the Studio Scripting API and add a MultiSound to it with the following code:

```auto
var actionSheet = studio.project.create("ActionSheet");
var sound = studio.project.create('MultiSound');
actionSheet.modules = sound;
event.relationships.parameters.add(actionSheet);
sound.audioTrack = event.masterTrack;

```

You can also use the following code to add an Multi Instrument to an existing action sheet on an event:

```auto
event.parameters.forEach(function (sheet) {
	if (sheet.isOfExactType('ActionSheet')){
		var sound = studio.project.create('MultiSound');
		sound.owner = sheet.modules;
	}
});

```

As for why your script creates a timeline in a new event, it appears there’s a slight difference between creating an event using the API and using the GUI. If you want to disable the timeline of an event created using the Scripting API, you can set `event.timeline.isProxyEnabled` to `false` to disable it, and to `true` to enable it.
