# Assign downloaded music to Event Track

**URL:** https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872
**Category:** Unity
**Created:** [March 12, 2021, 2:22pm UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872 "2021-03-12T14:22:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)
#### Post date: [March 12, 2021, 2:22pm UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/1 "2021-03-12T14:22:50Z")

</div>

Hi,

I’m wondering if it’s possible to specify a downloaded audio file in unity (using UnityWebRequest) to a specific track of an Event.

Now I have 5 tracks playing in sync from FMOD, but I’m wondering if I can load these audio files from the web and assign them to each track.

Is it possible?

I appreciate any help! 🙂

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [March 12, 2021, 3:24pm UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/2 "2021-03-12T15:24:57Z")

</div>

During the runtime? Maybe the programmer instrument is able to do such things, but I never used it so I can’t help further!

---

<div class="post-metadata">

### Author: ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)
#### Post date: [March 13, 2021, 11:47pm UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/3 "2021-03-13T23:47:44Z")

</div>

Yes, during runtime.

The idea is to allow the user to load different sets of multitracks.

I searched about the programmer instruments (I didn’t know about it), but still can’t realise how to target a downloaded audio file to a specific "programmer instrument.

I appreciate if anyone else can help here! 🙂

---

<div class="post-metadata">

### Author: ![aishi](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/aishi/32/82_2.png) [@aishi](https://qa.fmod.com/u/aishi)
#### Post date: [March 14, 2021, 2:03am UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/4 "2021-03-14T02:03:11Z")

</div>

It kind of takes a lot of steps. You’ll first need to create an event that contains a programmer instrument in FMOD Studio.

Then in C#, create an event instance of this event, and set the callback mask to include FMOD\_STUDIO\_EVENT\_CALLBACK\_TYPE.CREATE\_PROGRAMMER\_SOUND  
and  
FMOD\_STUDIO\_EVENT\_CALLBACK\_TYPE.DESTROY\_PROGRAMMER\_SOUND, pointing to your callback handler function that will receive these callbacks.

Most likely you’ll also set the userdata of that event to the name of the file you want to load and need to use a GCHandle to keep it from getting garbage collected.

In a callback function when the callback type is CREATE\_PROGRAMMER\_SOUND, you’d create the core sound there and assign it to the sound parameter, then it will play that sound.

When the callback type is DESTROY\_PROGRAMMER\_SOUND is where you’ll release the sound.

Here’s an example of this: [FMOD - Scripting Examples | Programmer Sounds](https://fmod.com/resources/documentation-unity?version=2.1&page=examples-programmer-sounds.html)

---

<div class="post-metadata">

### Author: ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)
#### Post date: [March 15, 2021, 3:14am UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/5 "2021-03-15T03:14:29Z")

</div>

OMG!  
My knowledge stopped when you mentioned callback mask! 🙂

I really wanted to learn how to do this integration, but I couldn’t understand how to manage this by myself for now.

Is there any easier tutorial of your knowledge?

Do you accept coding request on demand? What’s the price? 🙂

---

<div class="post-metadata">

### Author: ![aishi](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/aishi/32/82_2.png) [@aishi](https://qa.fmod.com/u/aishi)
#### Post date: [March 15, 2021, 7:21am UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/6 "2021-03-15T07:21:01Z")

</div>

I’m not familiar with FMOD tutorial resources besides what’s in the docs. I think it’s the quirks with interfacing with C++ code that makes this example more involved on the C# side.

Yes, I’m open to freelance requests, I just sent you a message 🙂

---

<div class="post-metadata">

### Author: ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)
#### Post date: [March 16, 2021, 12:22am UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/7 "2021-03-16T00:22:28Z")

</div>

The link @aishi provided to our Unity examples is the best we have for guiding you.

---

<div class="post-metadata">

### Author: ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)
#### Post date: [March 16, 2021, 1:49am UTC](https://qa.fmod.com/t/assign-downloaded-music-to-event-track/16872/8 "2021-03-16T01:49:28Z")

</div>

Thanks, Mathew.  
Unfortunately my c# level doesn’t allow me to implement my idea by myself for now.

I thought the connection between an audio file downloaded and a programmer instrument could be easier… or I’m simply blocked and can’t see how easy it is for now.

Thanks anyway! 🙂
