I’m currently working on a music game and just contact with Fmod for a few days. As I know, there’s no proper way for Fmod to read and use midi file information to trigger its instruments like DAW or Wwise.
Let’s say I’m trying to create a sampler in Fmod event and the midi which is loaded in Unity will trigger the event. What should I do to make the resulting sound in the right pitch, time, velocity, and other information such as pitch bend, glide, etc… that the midi file has?
Just to confirm, are you trying to playback a midi file in FMOD or are you wanting to read real-time midi data and use that to play events that have been setup in FMOD Studio?
If you want to playback a midi file in FMOD, FMOD can just playback a midi file using System.createSound and System.playSound and that will playback a midi file using general midi sounds.
If you want to read a midi file and use that to playback events in FMOD, assuming you have a midi parser already that is going to give you midi messages at appropriate times, you could then read the values of the midi message and use that to trigger a FMOD events. Here is a list of possible operations you could perform based on midi messages:
|MIDI Message||FMOD Operation|
|CC 1 Modulation / Pitch Bend||EventInstance.setPitch|
|CC 7 Volume||EventInstance.setVolume|
|CC 10 Pan||EventInstance.set3DAttributes|
|Any other CC||EventInstance.setParameter and setup a corresponding parameter in FMOD Studio|
The subject of parsing real-time midi data itself is non-trivial and beyond the scope of this forum, but it looks like there are a couple of open source projects around that can achieve this.