# Automated Event Creation from Folder / Audio File Structure

**URL:** https://qa.fmod.com/t/automated-event-creation-from-folder-audio-file-structure/23443
**Category:** FMOD Studio
**Tags:** unity
**Created:** [October 9, 2025, 5:44am UTC](https://qa.fmod.com/t/automated-event-creation-from-folder-audio-file-structure/23443 "2025-10-09T05:44:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![EWTube0](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@EWTube0](https://qa.fmod.com/u/EWTube0)
#### Post date: [October 9, 2025, 5:44am UTC](https://qa.fmod.com/t/automated-event-creation-from-folder-audio-file-structure/23443/1 "2025-10-09T05:44:42Z")

</div>

Hello FMOD Team,

I am currently working on a Unity project that uses a very large number of .wav files, organized in multiple folders (for example: Album/Instrumental.wav, Album/Vocals.wav, Album/Stems/Drums.wav, etc.).

At the moment, when I want to integrate these audio files into FMOD Studio, I have to manually create events for each file, or rely on drag & drop which still results in duplicate names (e.g. “vocals 2”, “vocals 3”), because FMOD requires unique event names. With hundreds of files across many folders, this process becomes extremely time-consuming and error-prone.

I understand that FMOD Studio supports scripting for automation tasks. Would it be possible for your team to provide a script (or guide me toward creating one) that would:

1. Import a folder structure of audio files (e.g. Music/Album/TrackName.wav).

2. Automatically generate corresponding events that mirror the folder structure (e.g. event:/Music/Album/TrackName).

3. Ensure unique event paths by using the folder hierarchy instead of appending “2”, “3”, etc. to duplicate names.

Having such a script would make it much easier to migrate existing projects with large audio libraries into FMOD, and would greatly speed up the workflow when working with structured assets such as multitracks or stems.

I believe this would be valuable not just for my project, but for any team wanting to transition from Unity’s AudioSource + AudioClip workflow to FMOD without having to manually rebuild every single event.

If your team has time to write this script or can point me to existing resources that might help, I would be extremely grateful.

I tried to write it on my own, but it doesn’t work.

Thank you very much for your time and support!

---

<div class="post-metadata">

### Author: ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)
#### Post date: [October 10, 2025, 12:56am UTC](https://qa.fmod.com/t/automated-event-creation-from-folder-audio-file-structure/23443/2 "2025-10-10T00:56:10Z")

</div>

Hi,

Here is an example script creating an event with same folder structure as its audio file:

> **Create Event From Audio File**
>
> ```js
> studio.menu.addMenuItem({
> name: "Create Event From Audio File",
> isEnabled: function() {
> var audioFile = studio.window.browserCurrent();
> return audioFile && audioFile.isOfExactType("AudioFile");
> },
> execute: function () {
> var audioFile = studio.window.browserCurrent()
> let assetPath = audioFile.assetPath;
> 
> let folderPath = assetPath.replace(/[/\\][^/\\]+$/, '');
> let fileName = assetPath.replace(/^.*[\\/]/, '').replace(/\.[^/.]+$/, '');
> 
> let parts = folderPath.split(/[\\/]/);
> 
> let eventFolder = studio.project.workspace.masterEventFolder;
> 
> for (let part of parts) {
> let existing = eventFolder.items.filter(c => c.isOfType("EventFolder") && c.name === part);
> if (existing.length > 0) {
> eventFolder = existing[0];
> } else {
> let newFolder = studio.project.create("EventFolder");
> newFolder.name = part;
> newFolder.folder = eventFolder;
> eventFolder = newFolder;
> }
> }
> 
> let event = studio.project.create("Event");
> event.name = fileName;
> event.folder = eventFolder;
> 
> let track = event.addGroupTrack()
> 
> var singleInstrument = track.addSound(event.timeline, "SingleSound", 0, audioFile.length)
> singleInstrument.audioFile = audioFile
> }
> });
> 
> ```

Create a new `ExampleScript.js` in your `C:\Users\User\AppData\Local\FMOD Studio\Scripts` to make the script accessible to all FMOD Studio version. Then in studio select an audio file and under the `Scripts` tab select `"Create Event From Audio File"`

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e163ef7850821dde86432fbbf27462892b173c35.png)  
It is possible to automate importing audio files with: [FMOD Studio | Scripting Api Reference Project - Projectimportaudiofile](https://fmod.com/docs/2.03/studio/scripting-api-reference-project.html#projectimportaudiofile) it is however not supported for creating new audio folder via scripting. So the audio file structure will have to set up manually.  
Let me know this is enough to point you in the right direction!

Docs:

- [FMOD Studio | Scripting Terminal Reference - Creating And Deleting An Event](https://fmod.com/docs/2.03/studio/scripting-terminal-reference.html#creating-and-deleting-an-event)
- [FMOD Studio | Scripting Terminal Reference - Adding A New Audio Track To The Selected Event](https://fmod.com/docs/2.03/studio/scripting-terminal-reference.html#adding-a-new-audio-track-to-the-selected-event)
- [FMOD Studio | Scripting Terminal Reference - Creating A Multi Instrument And Adding Instruments To Its Playlist](https://fmod.com/docs/2.03/studio/scripting-terminal-reference.html#creating-a-multi-instrument-and-adding-instruments-to-its-playlist)

Hope this helps!

---

<div class="post-metadata">

### Author: ![EWTube0](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@EWTube0](https://qa.fmod.com/u/EWTube0)
#### Post date: [October 10, 2025, 5:31am UTC](https://qa.fmod.com/t/automated-event-creation-from-folder-audio-file-structure/23443/3 "2025-10-10T05:31:54Z")

</div>

Yes, thank you. That’s exactly what I needed
