Assign downloaded music to Event Track

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! :slight_smile:

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

1 Like

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! :slight_smile:

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

1 Like

OMG!
My knowledge stopped when you mentioned callback mask! :slight_smile:

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? :slight_smile:

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 :slight_smile:

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

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! :slight_smile: