# How to load MIDI file and retrieve played notes

**URL:** <https://qa.fmod.com/t/how-to-load-midi-file-and-retrieve-played-notes/13547>\
**Category:** Unity\
**Created:** [November 20, 2017, 6:00pm UTC](https://qa.fmod.com/t/how-to-load-midi-file-and-retrieve-played-notes/13547 "2017-11-20T18:00:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CDKML](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@CDKML](https://qa.fmod.com/u/CDKML)\
**Post date:** [November 20, 2017, 6:00pm UTC](https://qa.fmod.com/t/how-to-load-midi-file-and-retrieve-played-notes/13547/1 "2017-11-20T18:00:03Z")

</div>

So my question is divided in 2 groups  
First one is kinda noob, but it’s because i’ve been using FMOD just for a few days and spent on research for this issue:

1. How can I load a MIDI file in FMod? I just can’t drag it into the audio track. I researched a little bit and maybe i need to load first a custom sound bank such as gm.dls?
2. Once the MIDI file is played, is there a way to retrieve the information of the played notes and store them in variables?

---

<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:** [November 20, 2017, 11:20pm UTC](https://qa.fmod.com/t/how-to-load-midi-file-and-retrieve-played-notes/13547/2 "2017-11-20T23:20:32Z")

</div>

Hi Kamal,

If you are using an FMOD Studio project, you will need to use a Programmer Instrument in the timeline and then add the MIDI file into your game code where FMOD::Sound would normally be loaded. Take a look in the Studio API example Visual Studio project (available in downloads) at the programmer\_sounds project. There currently isn’t a way to add a MIDI file directly into an FMOD Studio project.

If you are using the low-level API you can simply load the MIDI file into an FMOD::Sound and it will work there.

[https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD\_System\_CreateSound.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_System_CreateSound.html#/)

FMOD can only read and playback MIDI files so the only function available to get information is just about how long the MIDI file is:

[https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD\_Sound\_GetLength.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_Sound_GetLength.html#/)

You would need either a custom script or third party program to provide you with information on what notes are being played.

Thanks,  
Richard
