Instead, I'm using the "Procedural MIDI" plugin by Scott Bishel available on the Unreal Marketplace, and a piano model I purchased several months ago. The keyboard that came with that piano had the keys fused together, so I had to separate them first in Blender, then import them into UE4, each with unique names for each key. The Procedural MIDI plugin allows the data from the MIDI file to be accessed by Blueprints, which in this case changes the position of one of the 88 keys. Several hours later, and after coding an extremely laborious Blueprint, I have this video:
Here is the basic Blueprint to run the key movements:
The first half essentially opens the MIDI file, and plays it. The second half siphons off the MIDI data as it is played, and assigns the note data to a single variable. A function in the middle (see below) translates that number to a specific key on the keyboard, then whenever the MIDI file triggers a "note on" event, the key referenced by the Receive Note Name function is rotated by -3°; a subsequent "note off" event returns it to 0°. Here is that function (the "Are we there yet?" function), which goes through every note on the keyboard, and confirms if it is the one that should be moved or not:
And this is as much as could fit on the screen at once:
No comments:
Post a Comment