Free LScript plugin: Legato MIDI keyboard

vncnt

Well-known member
Free LScript plugin: Legato MIDI keyboard.
The plugin is almost finished and will be published slightly later, including some demo files to get started.
Some minor bugs to fix, and maybe adding the ability to Save/Load plugin data with the scene.

Legato MIDI keyboard has been inspired by the Pixar Soul production: controlling a virtual keyboard by a MIDI file.
The technique has been used to guide the animator to use the correct keyboard keys at the right moment.
Of course it can also be used to control a virtual Pianola, or any other MIDI/DMX controlled virtual effect.

Note-On and Note-Off data is used to add keys to the appropriate item envelope, and optionally to its Dissolve envelope.
To simulate a real physical keyboard (presets for Grand Piano, Organ, Hammond B3, Custom) the speed of the key movement can be adjusted, including the electrical switching point. The default speed can be modulated by the Velocity value (of each Note-On event) from the MIDI file.

After MIDI Envelopes have been initialized, they can be filled with data from an external MIDI file.
Use other software like Reason Suite 11 (or any other) to record/edit a keyboard performance and export it as a .mid file.
For now my plugin is only compatible with Allegro MIDI files: simply drag a .mid file to Audacity and export it as a (human readable) .gro file.

The MIDI Envelopes can be transfered to numbered Items: Nulls or Meshes.
It has a built-in "Null Keyboard" generator.
The plugin handles multiple keyboard hierarchies.

It's an additive process: you may select certain tracks to be added to the MIDI Envelopes and/or Bind Channels.
Instead of using a Rotation channel (Pitch), you could also select any other Position, Rotation or Scale channel.

MIDI Envelopes can be transposed up/down while transfering them to the keyboard hierarchy.
For example to fit the performance (single or multiple tracks) on a smaller keyboard.

Also, you could "Show" active keys and/or "Hide" active keys: if you create two sets of keyboard hierarchies you can change the color of the keyboard key when being played.

Load a .wav file in Layout to verify that your virtual keys are operated in sync with the music.

MIDI_interface.png
 

vncnt

Well-known member
Okay, here we go.

Download the attached ZIP file and copy the "midi_demo" map on your project drive.
It contains the .lsc plugin file for LW2015 .. LW2020, a readme txt file with a basic procedure.
The "midi" map contains a ZIP file with the original Reason setup, the .mid export file, and also the .gro file as exported from Audacity 2.4.2 (v3 is already available).
These files contain just a few simple notes, nothing commercial.
The "audio" map contains a 22,050 Hz stereo 8 bit WAV file. I've reduced the quality to keep it compact.

I've had to expand and reorganize the interface a little, and I've managed to move the most important buttons to the right side.

MIDI_interface2.png


Since the plugin location and project files in your setup can be slightly different it does not make sense to add the scene files in this ZIP.
Follow the steps in the read me file and you'll be fine.

In general, the plugin expects you to:
  1. Choose a keyboard type - the specs need more testing, Average Key Velocity is the handling speed of a key at Note Velocity = 63 (0 .. 127).
  2. Initialize MIDI Envelopes (MIDI.key_#).
  3. Setup your Allegro (.gro) file (view it in Notepad).
  4. Choose a Track ID you want to apply (the demo file contains 3 tracks: "Downtempo", "Big Pan Flute", "Angry Analog Bass" ).
  5. You might want to transpose by octaves or semitones to untangle the available tracks (for now, use the default values).
  6. Run MIDI Statistics first, to unlock the rest of the interface.
  7. For each track you want to use on the same keyboard: choose Track ID + press button "MIDI Data -> MIDI Envelopes".
  8. Now, press button "Generate Null Keyboard" (you might want to use a real 3D model for this, and name each key).
  9. Verify that Bind Channel is set to Rotation.P (you are free to use the other channels).
  10. Finally, select any item in your keyboard (or the parent item), and press button "MIDI Envelopes -> Hierarchy".
  11. Identify an audio file, then press button "Load Audio" to use it on the LW timeline or "Clear Audio" to remove it (the file name remains).
All parameters are saved in your LWS scene file. This makes it easier to recreate a certain setup.
Very short notes (Rhythm sections or after slicing notes in the editor) are handled.
Overlapping notes are handled.
Notes with duration 0 (at the end, the note-off event outside the selected region) are handled.
Note-on/off keys will use Bezier type of curves by default (except for the overlapping keys).
Dissolve keys will use Linear type of curves by default - use this channel to hide/unhide two sets of keyboard keys with different colors to mark active keys by color.

Let me know if you encounter bugs, have questions, or maybe you have remarks about the keyboard presets.
If you want to share 3D models of your keyboard, please do.

Have fun!
 

Attachments

  • midi_demo_9-APR-2021.zip
    838.3 KB · Views: 41
Last edited:

vncnt

Well-known member
HammondB3_Oct6.gif


A first simple test with Hammond B3 Octave6, key_84 .. key_96.
Test pattern applied.

Please remind to Export individual keyboard key layers to separate Object files [EDIT: THIS HAS BEEN CHANGED IN VERSION 9-APR-2021], and give them one single parent in the Scene (just like the Null keyboard).
The plugin needs the parent to find its Child Items.
 
Last edited:

vncnt

Well-known member
Small bug fix: the Ident field now supports strings longer than 4 characters.
This opens the door to object layers.

Use format: Object_name:Layer_name (Layer_name without sequence number)
or format: Object_name (Object_name without sequence number).

Also moved the Ident data field to the "Initialize MIDI Envelopes" button level,
because the init function is the first function that is actually using this field.

Reminder: you must select the master or (any) child item before you
press button "MIDI Envelopes -> Hierarchy".

I've updated the ZIP in the download link, available in message #6 of this thread.

MIDI_interface3.png


Btw, I can spot another bug already. Can you?
 

Svenart

8bit rules
Hey, you have made a very interesting plugin. Just today I was thinking to animate a keyboard with midi file, asked in a FB Group and they showed me this link... GREAT! I just tested your plugin with the Null Keyboard and it seems to work. However, I don´t understand completely right now how to use it with a keyboard model. Would it be possible to add an example scene to the plugin or could you create a video tutorial? Actually, I would love to do an tutorial or example video of your plugin myself, I just would need to completely understand the plugin and how to work with it.
 

sami

Active member
Hey Nice plugin!

Question though, this seems specific to a keyboard animation. I am unaware of if it exists, but is there a generic MIDI plugin for LW that lets you load & examine a MIDI file and generate envelopes or drive any animations from it?
 

vncnt

Well-known member
The trick is to add the name of your object to the Ident, separated by a colon symbol:
myObject:myLayer
For example: Hammond_XK-3c:key_
and don't forget to parent all layers to a single parent.

If you put every keyboard key in a dedicated object, you can name them key_#
Replacing # with the key number.
Use Ident key_ and and parent all objects to a single parent.

The single parent is needed to process all child items.
The Ident is used to identify each individual key.

I've written a simple tutorial to get started:
http://home.kpn.nl/vincentmesman/midi.html

And I'm also preparing a video that demonstrates the transfer of MIDI note data to a keyboard model.
Stay tuned.
 

vncnt

Well-known member
Hey Nice plugin!

Question though, this seems specific to a keyboard animation. I am unaware of if it exists, but is there a generic MIDI plugin for LW that lets you load & examine a MIDI file and generate envelopes or drive any animations from it?

I did find this: http://interialabs.de/lw/lscript/midi2lw.html but I haven't tested it.

For me, the biggest challenge was to handle the note on/off data and send it to a set of keys, controlled by a friendly interface.
 

PetGerbil

Member
Hey Nice plugin!

Question though, this seems specific to a keyboard animation. I am unaware of if it exists, but is there a generic MIDI plugin for LW that lets you load & examine a MIDI file and generate envelopes or drive any animations from it?
I did use this years ago, http://www.tmproductions.com/programs/midichannel
It's not as advanced as vncnt's, and I've no idea if it still works. But it does/did what you want. (sorry for the hi-jack)
 

vncnt

Well-known member
I did use this years ago, http://www.tmproductions.com/programs/midichannel
It's not as advanced as vncnt's, and I've no idea if it still works. But it does/did what you want. (sorry for the hi-jack)
It looks like it would need 1 plugin per keyboard key.
The Legato MIDI Keyboard plugin will address a maximum of 128 notes -> or 128 keyboard keys, in 128 layers or 128 separate object files.

At this moment LMK doesn't filter channels, voices, instrument changes, tempo changes, modulation wheels, etc.
A detailed spec of binary MIDI files or a decoder would be helpful.

Ideas are welcome.
 

vncnt

Well-known member
A new version is being prepared - some bug fixes to do (Bezier curve properties) before the next release.

Bezier.png


New features:
  • Export button to store plugin settings from a default file
  • Import button to retrieve plugin settings from a default file
  • Get Ident From Selected Object button
  • Lock all keyboard keys
  • Unlock all keyboard keys
  • Hide passive keyboard keys within preview range
  • Unhide all keyboard keys
  • Follow Key: select 1 keyboard key + 1 finger controller to copy keyboard keys to a finger controller channel. This will add keys for that finger on the right moment but you might need to finetune the up/down angle a little for best results.
  • Follow Channel: target channel for Follow Key
Debug:
  • MIDI and audio file names were not correctly being restored when reopening the dialog
 
Last edited:
Top Bottom