private List <Note> LoadNotesFromMidiFile(string midiFilePath)
    {
        List <Note> loadedNotes = new List <Note>();

        MidiFile midiFile = midiManager.LoadMidiFile(midiFilePath);

        if (midiFile == null)
        {
            throw new UnityException("Loading midi file failed.");
        }

        Dictionary <int, Note> midiPitchToNoteUnderConstruction = new Dictionary <int, Note>();

        foreach (MidiEvent midiEvent in midiFile.Tracks.SelectMany(track => track.MidiEvents))
        {
            if (midiEvent.midiChannelEvent == MidiHelper.MidiChannelEvent.Note_On)
            {
                HandleStartOfNote(midiEvent, midiPitchToNoteUnderConstruction);
            }

            if (midiEvent.midiChannelEvent == MidiHelper.MidiChannelEvent.Note_Off)
            {
                HandleEndOfNote(midiEvent, midiPitchToNoteUnderConstruction, loadedNotes);
            }
        }
        Debug.Log("Loaded notes from midi file: " + loadedNotes.Count);
        return(loadedNotes);
    }