# Script to import a WAV and create an event with that AudioAsset?

**URL:** <https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255>\
**Category:** FMOD Studio\
**Created:** [December 13, 2018, 11:00pm UTC](https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255 "2018-12-13T23:00:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbgben](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jbgben](https://qa.fmod.com/u/jbgben)\
**Post date:** [December 13, 2018, 11:00pm UTC](https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255/1 "2018-12-13T23:00:18Z")

</div>

I could not find any examples on how to do this. I import a wav file using studio.project.importAudioFIle(), and can create an event using studio.project.create(“Event”), I can make a Group Track with event.AddGroupTrack()…but then I’m not sure how to connect these all together. I want to make an event using the imported WAV file.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [December 14, 2018, 3:56am UTC](https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255/2 "2018-12-14T03:56:11Z")

</div>

Hi Ben,

A lot of what you’re trying to do is made simpler by having the functions returns return to a variable.

```
    var asset = studio.project.importAudioFile("C:/Path/To/Sound/Test.ogg");
    var event = studio.project.create("Event");
    event.name = "Test event";
    var track = event.addGroupTrack();
    var sound = track.addSound(event.timeline, "SingleSound", 0, 10);
    sound.audioFile = asset;
    sound.length = asset.length;

```

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![okaybenji](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/okaybenji/32/1346_2.png) [@okaybenji](https://qa.fmod.com/u/okaybenji)\
**Post date:** [July 20, 2021, 6:12pm UTC](https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255/3 "2021-07-20T18:12:34Z")

</div>

Sorry to reopen an old thread, but how can I achieve this in Unity with C#? I can’t seem to find the C# equivalent of `studio.project.create`. I need to create Events at run-time from sound files on disk. Thanks!

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [July 20, 2021, 11:36pm UTC](https://qa.fmod.com/t/script-to-import-a-wav-and-create-an-event-with-that-audioasset/14255/4 "2021-07-20T23:36:37Z")

</div>

It’s not possible to create events at runtime. If you are looking to play loose sound files you will need to utilize `FMOD::Sound`. In Unity you will need to grab the Core system using `FMODUnity.RuntimeManager.CoreSystem;` first.

Just for future reference, it’s better to create a new topic for these questions and paste a link to solved questions if it needs more context.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-sound.html](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-sound.html)
