jack-keyboard is the solution that is most likely present already, ‘grabbing’ the keyboard does seldom work, so it’s best to ‘keep on top’ the keyboard window and activate it again and again. I also like LMMS’ interface(s) a lot for swift MIDI composing, I think it’s a good example in that regard. But in Ardour, expanding the track vertically and clicking on the note keys also allows very simple testing.
What I’d love to see (or maybe eventually write myself, but I’m still lacking expertise) one day is a program that can isolate a cheap USB keybord from the nearest car boot sale, i.e. by its vendor & product id, and use it as a dedicated virtual MIDI keyboard rather than merging it with other input devices.
I’ve begun reading up on X and udev once when I wondered how feasible it was to have a US and a Spanish keyboard using their respective layouts side by side, but didn’t get anywhere with my current skill level, but yes, feasible it seemed.