The virtual keyboard object is available from the ELSE library in plugdata but is not available by default in vanilla Pd.
A notein object reads and parses MIDI note messages from an optional port and channel (default is all ports and channels).
A noteout object formats and transmits MIDI note-on and note-off messages to an optional port and channel.
Port numbers are encoded within the channel number. Channels 1 to 16 are for port 1, channels 17 to 32 is the same as channels 1 to 16 for port 2, etc...