[LAD] MIDI in jack

Len Ovens len at ovenwerks.net
Mon Jul 7 06:54:52 UTC 2014

On Mon, 7 Jul 2014, Flávio Schiavoni wrote:

> It sounds to me like a keylogger as the input + MIDI (Jack or ALSA) as 
> output. Maybe a ring buffer or something in between.
> If a keylogger is the kind of input you wish:
> https://www.thc.org/papers/writing-linux-kernel-keylogger.txt

Key logger yes, but not built into the kernel... I remember rolling a 
kernel with the install (before modules showed up) and for every update 
too, but I already have examples that work after the kernel, but before X.

> Trying to guess a naive code implementation, I foresee two problems:
> - If one press a key and keep it pressed, the computer keyboard 
> repeeeeeeeeeeeeeeeeeeeeat the key, generating several NOTE_ON midi 
> events.

Yes, that can be generated inside the kb. And as I want to use a USB Kb, 
it could be worse. I think the typmatic rate can be changed though... Yup, 
if X can turn it off, so can I. actkbd allows setting changes based on key 
up or down.

> - Without a high level API I don´t know if you will have a KEY_RELEASE 
> event to generate a NOTE_OFF event. If you have it you can solve the 
> former problem.

According to what I have read (I may be wrong, or it may not apply to all 
KB) when the kb repeats it sends both on and off. So turning it off seems 
like a good idea.

I wasn't thinking of making a synth kb to turn notes off and on, but some 
of the sw seems to do that just fine, X based or event based.

I want to do this in steps:
- Use a laptop extra number kb for transport control.
- Split the system kb to do the same thing
- play with a second keyboard see if I can get encoders to make sense.

This is the hardware I have on hand. If it works the way I want I will try 
further mods. The LSMI project puts it into words better than I do. It 
also says old AT kb are best.... I have one, but do not want break it 
because the touch is so nice, I have been buying MB that it will work 
with. USB kb are cheap at $3 if you know where to look. I can afford to 
break one. I will never be able to press all the keys at the same time, 
there will many key combinations that will not work too, but there may be 
still a lot of uses for it.

The big thing is it will teach me more about code and the system. I could 
just go and buy a midi controler.

Len Ovens

More information about the Linux-audio-dev mailing list