Discuss other brands keyboards, synthesizers, modules, software, controllers including how they compare or work with the Nords.

pc keyboard to midi (without computer)

Postby Mr_-G- » 22 Mar 2013, 19:02

Hi,
I would like to work in a cheap diy project for an alternative controller (actually I am interested in trying an isomorphic kbd) and I would like to have an old pc keyboard to send MIDI out, without having to use a computer.
I thought that something like an arduino board or similar might be able to do it, (and I understand that a pc kbd would not send velocity data, but that's still OK).
Does anybody know of such a diy circuit or box that would do that?
I am aware that with a computer this becomes trivial as there are several programs that do this sort of thing already, but I am trying to avoid having to carry a pc around just for this.

Thanks for any pointers.
User avatar
Mr_-G-
Moderator
 
Posts: 4617
Joined: 18 Aug 2012, 16:48
Has thanked: 1475 times
Been thanked: 1257 times
Your Nord Gear #1: Nord Stage 2

pc keyboard to midi (without computer)


Sponsor
 

Re: pc keyboard to midi (without computer)

Postby mjbrands » 23 Mar 2013, 19:10

Would you want to use an USB, or PS/2 keyboard? Also, would you want to build the electronics into the keyboard, or just connect the keyboard to some external box with a MIDI out port?

It seems to me it wouldn't be that hard to build something with an Arduino UNO (or a clone). Both MIDI and the PS/2 protocol are supported out-of-the-box, so it might be an interesting project to tinker around with. USB could also work, but is a harder to implement as it requires USB host support (most boards like this only have USB device support).

Something like a Teensy is Arduino compatible (so you can use their development environment) but is so small it'll easily fit inside a keyboard.

Edit: it might be fun to remove the PS/2 connector on one of those coiled cables and to mount a MIDI (DIN5) connector on it :mrgreen:

You might even be able to run all the electronics from the power provided by the MIDI port, although that's not officially supported.

Edit: that only works when receiving MIDI - doh!
Last edited by mjbrands on 23 Mar 2013, 21:02, edited 5 times in total.
mjbrands
 

Re: pc keyboard to midi (without computer)

Postby mjbrands » 23 Mar 2013, 19:34

Hmm, you could mount one of those touch strips above the function keys and set it up so you could either use it to send a bend/mod signal, or use it to change the velocity 'playing' on the keys would send.
mjbrands
 

Re: pc keyboard to midi (without computer)

Postby mjbrands » 24 Mar 2013, 06:10

I pulled apart an IBM PS/2 keyboard I had lying around. It uses a 18x8 matrix for scanning the keys. Without testing anything, I think the following circuit could work:

Image

It would probably be easier (and more likely to work :-)) to use a Teensy++ 2.0 instead of designing the circuit myself. In either case, a regulated 5V power supply would need to be connected to the keyboard (unfortunately). With the Teensy, it might be possible to have the thing function both as a USB and as a MIDI keyboard (haven't looked at this, but this just occured to me) where the external power supply wouldn't be needed anymore (if connected via USB).

The ESC key could function as a MIDI panic button. Keep it pressed down while powering up and you enter a simple settings menu that uses the three LEDs (caps lock, scroll lock and num lock) for feedback and the keys for selecting options.

While playing, pressing any of the function keys (F1 thru F12) changes the velocity sent from 1 to 127 (probably on some logarithmic scale). The numeric keypad could may be be used to select between different musical scales for the main keys. You can have multiple keys pressed down and the software will correctly handle the sending of note on/off MIDI messages.

Anyway, just thinking out loud (and completely ignoring the fact the software is the most complicated part)...
Last edited by mjbrands on 24 Mar 2013, 07:14, edited 7 times in total.
mjbrands
 

Re: pc keyboard to midi (without computer)

Postby Mr_-G- » 24 Mar 2013, 13:01

Wow mjbrands, that is very interesting. Yes, I was thinking PS/2 as those seem to accumulate everywhere as junk while new kbs are all USB.
The idea is to connect the pc kbd directly to a MIDI instrument. That would also get round connecting 2 pc kbds to a pc and not mess up the typing input (as they would go through different interfaces and the input handled differently. The 5V issue I guess would be sorted with 3 or 4 1.5V batteries?

I also had a look at one of the pc kbds I had around unused and this is what it has as controller.
top.jpg
top.jpg (24.11 KiB) Viewed 4180 times


The LEDs are from left to right NumLock, CapsLock and ScrollLock
and this is from the bottom

bottom.jpg
bottom.jpg (28 KiB) Viewed 4180 times


but I am not sure I understand the pin assignment of the IC (most likely it is not the same as the one you have?).
Any further insights you can provide would be greatly appreciated.
User avatar
Mr_-G-
Moderator
 
Posts: 4617
Joined: 18 Aug 2012, 16:48
Has thanked: 1475 times
Been thanked: 1257 times
Your Nord Gear #1: Nord Stage 2

Re: pc keyboard to midi (without computer)

Postby cosmodrome » 24 Mar 2013, 13:28

Instead of bothering with an Arduino and an additional UART for the keyboard and implementing the keyboard to MIDI stuff by yourself (which might be not so trivial if you want to keep latencies down) it might be worth looking at a Raspberry Pi based approach. This would have the advantage of an existing keyboard port as well as an OS that does all the IO for you as well as an existing (and very good) MIDI-implementation in the kernel. All you'd have to do is execute a few shell commands to connect your virtual keyboard to a MIDI channel. Linux also provides a complete implementation of MIDI over ethernet in the standard ALSA-MIDI stack.
I guess the Raspberry thing would not be much more expensive than an Arduino with the additional parts to connect keyboard and MIDI. However, the new ones have an extra USB port, so I might be wrong. Nevertheless, a Raspberry would be able to do pretty much the whole thing out of the box. Especially, if you manage to score a cheap serial MIDI interface at eBay. I think about various older models unsupported by newer OSX or Windows versions but compatible Linux' serial or parallel MIDI drivers.
Last edited by cosmodrome on 24 Mar 2013, 13:29, edited 2 times in total.
cosmodrome
 

Re: pc keyboard to midi (without computer)

Postby Mr_-G- » 24 Mar 2013, 14:16

Thanks cosmodrome, yes that is interesting too although I would want the whole thing to be as simple as possible to work with.
The idea is to create a simple version of an isomorphic keyboard like the Axis 64 (discontinued? where do you get one from in the EU?) that can be plugged in and be able to play straight away.
If I need an hdmi display to set the kbd up via a console, then that the whole thing becomes more difficult to set up and carry around. Maybe that is not a problem and setting all those commands as an autorun sort of batch process avoids needing a display, but I do not have a raspberry pi to try, nor I know anybody who does to ask.

I am suspecting that are more problems ahead for a simple device such as latency and how to map the keys to midi messages (one would have to process the key pressed to a particular look up table of of midi note on/off bytes messages, but if doable, it would be great.

Edited typo
Last edited by Mr_-G- on 24 Mar 2013, 15:45, edited 1 time in total.
User avatar
Mr_-G-
Moderator
 
Posts: 4617
Joined: 18 Aug 2012, 16:48
Has thanked: 1475 times
Been thanked: 1257 times
Your Nord Gear #1: Nord Stage 2

Re: pc keyboard to midi (without computer)

Postby mjbrands » 24 Mar 2013, 14:47

This is the controller mine has.

Image

I could use the PS/2 connector at the top left (CN3), I I think I'm going to rip off everything except the two black connectors (CN1 and CN2), the three LEDs and their associated resistors (R5, R6 and R7).

I have an Arduino Mega 2560 lying around and to build a prototype I'd only need some veroboard, a MIDI socket and two 220 ohm resistors (which I probably have). I could probably even just wire up the MIDI socket and not bother with the veroboard.

Looks like they're using a single LED in your case for the LEDs. How is the key scanning matrix connected to your controller? Does the controller plug into some other connector? In mine the matrix (printed on transparant plastic) plugs into the two black connectors.
mjbrands
 

Re: pc keyboard to midi (without computer)

Postby Mr_-G- » 24 Mar 2013, 15:44

mjbrands wrote: How is the key scanning matrix connected to your controller? Does the controller plug into some other connector? In mine the matrix (printed on transparent plastic) plugs into the two black connectors.


It is connected in a curious way. The black terminals in the "bottom.jpg" image above align and touch the terminals in the transparent plastic sheet you mention above. When screwing the base of the keyboard, there is a piece of springy rubber that keeps them touching (so just some pressure :roll: )

If you could post a photo of the back of the controller (if not incovenient) that would help me understand what the wiring in my kbd might be because as you can see the connectors are all there and I still can't tell yet where is what :)

Just for completeness, it might be handy the pinout of the pc kbd cable:
ps2pinouts.jpg
ps2pinouts.jpg (19.31 KiB) Viewed 4157 times
User avatar
Mr_-G-
Moderator
 
Posts: 4617
Joined: 18 Aug 2012, 16:48
Has thanked: 1475 times
Been thanked: 1257 times
Your Nord Gear #1: Nord Stage 2

Re: pc keyboard to midi (without computer)

Postby mjbrands » 24 Mar 2013, 23:38

Image
Image
Image

The top layer has the carbon contacts on the bottom, the middle layer just has holes where the contacts are and the bottom layer has the contacts at the top.

If you have something similar, the contacts might not be grouped together on the 'connector' end, but you should have a top and a bottom side. I could scan mine 18 times and get back 18 8-bit values, where every bit stands for a key pressed down. I'm sure not all combinations are used, but I expect most of the 18 'rows' to have about 5-7 'columns'.
mjbrands
 

Next

Return to General Synthesizers/Keyboards Forum



Who is online

Users browsing this forum: No registered users and 8 guests