This project was solely made as study case about integrating a non-unity oriented C# library into Unity, and using it to add a functionality that Unity would otherwise lack. In this project, I integrated the DryWetMidi library, with the purpose of creating a midi interpreter, with the ultimate goal of making a rhythm game with this system, including basic midi file generation within the editor.
This project was also a study towards audio sources in Unity, their optimalization level and the use of dynamic creation and assignment of sound sources. As of now, there is a simple channel setting that you can use to change the amount of sound sources attached to the process, which in turn dictates how many notes the interpreter can play at the same time, or in rapid succession, without audio cutoff.
Midi files have rhythmic data embedded into them. The program can read those and automatically play the song at the right speed. There also is an option to ignore the rhythm data and override it manually.
I use simple MP3 files that serve as the instrument, set up through a scriptable object. There is an option to include multiple sound sources within an instrument in the form of high and low notes, allowing the reduction of sound distortion when the notes are far outside of the intended range of the sound source. There also is basic note offset, volume and pitch manipulations for the source audio.
Just like with all my other editor tool projects, it is a component based solution, so that only components that are applied to an object will affect that project. This prevents cases where bugs are caused by "managing" scripts unintendedly affecting an object
I wrote a custom editor UI to make the tool clean and easy to use. It also includes a file loading button, which opens a file explorer window to select a midi file with.