Automated Event Creation from Folder / Audio File Structure

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!

Hi,

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

Create Event From Audio File
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"


It is possible to automate importing audio files with: FMOD Studio | Scripting Api Reference Project - 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:

Hope this helps!

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