MIDI Help for My Singing Monsters Fangame

Godot Version

Godot 4.6.2

Question

Hi ^^

For the last bit now, I’ve been attempting to make a game similar to My Singing Monsters, like a fangame of sorts! The section that I really wanna focus on is the singing aspect.

In my project, I wanted to have the MIDI file I was using to determine whenever a monster sings, since that’s what MSM did.

I had used the Midi player plugin by arlez80 to track the midi events, and when I had coded one monster in, it seemed to be working perfectly!

..until I added a whole other one.

When I added the second monster, it only seemed to be playing THAT monster’s midi track instead of them both! I attempted to figure out why it had only played that monster’s track specifically, then I realized that it was only playing the most recent track added! (or well, the track at the bottom of the midi file..) I racked my brain around for the longest time ever.. I didn’t know how to make it so that the function I used tracked all midi sounds instead of just one, so I attempted to start again with some other plugins.

..it didn’t go as well, so I’ve come here as a last effort to see if any of you know how I could make it so it doesn’t focus on one midi track in a single channel, but all of the midi tracks inside that channel!

Best bet is to post in the issues for the project. Looks like it hasn’t been updated in a year, but its’s worth asking. No one here is likely to know anything about that plugin.

I see. Thanks for telling me :slight_smile:

I haven’t used MIDI plugins for Godot, and I’m not 100% about your issue, but would it be possible to have one MIDI player and assign the monsters a channel each? So each monster checks if it’s receiving from its particular channel. That does limit the number to 16, but it should isolate the channels from each other.

Something like this:

func _on_midi_event(channel: int, event) -> void:
    if channel != this_monsters_channel:
        return
        
    if event.type == 9 and event.velocity > 0: # arlez80 standard
        start_singing(event.note, event.velocity)
    elif event.type == 8 or (event.type == 9 and event.velocity == 0):
        stop_singing()