I'd like to implement a playable piano in a project I'm working on. Essentially, when a user clicks on a button, the piano note starts to play and keeps playing until they stop pressing the button. Many programs handle this by sending note events to a MIDI sound playing library. I'm having trouble trying to figure out if Godot had this capacity. Godot can accept MIDI input. I've seen posts saying it does not have MIDI output, but is unclear to me because that could just mean it cannot output to a MIDI device which is not the same thing as playing MIDI notes . There does seem to be a MIDI player written in GDScript, but I don't know how they're going about producing their sound.

Is there a way for my program to tell Godot to play individual MIDI notes?

    5 days later

    kitfox
    In my game Synesthesia, I played individual MIDI notes using the godot-midi-player plugin by arlez80:

    It is capable of playing midi files as well as receiving calls for individual midi events. In the how to use section of the documentation on the Bitbucket page there's information on calling individual midi events:

    5 days later

    Thanks for the reply. Your Synethesia game was a lot of fun. I liked how the music only advanced as your character did.

    I am running into a bit of trouble with the code on the how_to_use page. The demo code seems to be incorrect. The line
    events.append( SMF.MIDIEventChunk.event( 0, 0, SMF.MIDIEventProgramChange.new( 3 ) ) )
    won't compile because SMF.MIDIEventChunk.event is a field and not a function. I looked at the source, but it's not clear to me how to fix this.


    Edit: I was able to get sending raw MIDI events working, so it looks like I only needed the top bit of code on that page.