#Midi-Input//how to open .sf2 file via Code?

10 messages · Page 1 of 1 (latest)

edgy walrus
#

hey, so id like to implement midi into my game.

on the one hand, I want the player to be able to just play whatever, while the notes, that get produced, get played like they would if you were to play in fl studio with a plugin for example.
on the other hand, i also want to be able to detect which notes get played and checked if theyre correct or not (quiz type thing).

I know that there is the midi detection thing built into godot, but im not so sure about the notes getting outputted(?).

Is there a way to implement these concepts with the built in stuff in godot, or should i use a plugin to handle that?
(ive already tried to look into the plugin stuff with https://bitbucket.org/arlez80/godot-midi-player/src/master/ but i kinda dont understand how it works haha)

mellow raptor
# edgy walrus hey, so id like to implement midi into my game. on the one hand, I want the pl...

i don't know a lot about audio, but there's this midi input which you can use. more info on the page too, maybe that helps https://docs.godotengine.org/en/stable/classes/class_inputeventmidi.html

obtuse trail
#

Godot does support MIDI input, but it's very low-level. It only works with raw MIDI signals (like Note On/Off). You need to parse the channel, pitch, and velocity yourself. This could work natively for your quiz system, since you can detect which notes were played and when.

For playing sounds like FL Studio, Godot does not natively support MIDI output to soundfonts or virtual instruments. MIDI is just data; to turn it into audio, you need a synth backend. Either use a plugin (like Godot MIDI Player) or you can pre-record/use samples of notes and then trigger them based off the MIDI note recieved.

#

Godot MIDI Player uses FluidSynth to play MIDI through SoundFont files. You would setup a AudioStreamGenerator, load a SoundFont file, and send MIDI data to it.

edgy walrus
#

thank you for your answers, i apologize for only now responding.

edgy walrus
edgy walrus
#

i have the .sf2 in the godot project folder, but it doesnt get shown on the bottom left of the godot gui, and therefore (?) it seems to not get recognized

#

how do i fix this?

#

Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN this is the error btw