Building Keykit on Raspberry Pi
[KeyKit](http://nonsuch.com/keykit/] is an interesting programming environment for midi music, combining graphical and programmatic control. The interface is extensible. Best of all, it was written before 2000, so it doesn't require a beasty machine.
There was no pre-built package for the raspberry pi, so I thought I'd have a go myself. I haven't done much compiling from sources since my early days using Linux.
I'm running the standard Raspbian distro.
Registering at the download site allows downloading the source. I was just interested in the alsa version-- haven't tried the raw midi version at all.
Extracting the zip creates a keykit77b folder, but running make installlinuxalsa fails with different errors. There is a useful readme_linux.txt file, but it didn't solve my immediate problems. Here's what I did to get it working:
- chmod u+x to src/rmcr (this is just making the dos line endings into unix ones)
- byacc (Berkley yacc) is included as a binary under byacc/ -- this won't work, neither will the dos version, obviously.So we need to use a proper version of byacc.
- sudo apt-get install byacc
- cd byacc/
- mv byacc byaccbroken
- ln /usr/bin/byacc byacc
- We also need some missing header files
- sudo apt-get install libasound2-dev
- sudo apt-get install libX11-dev
- Running make will fail because it can't fint ytab.c or ytab.h
- byacc is creating y.tab.c and y.tab.h, so just mv the files
- cd src
- mv y.tab.c y_tab.c
- mv y.tab.h y_tab.h
- first I tried to change the src/makefile to use the right names, but this seems to be recreated after each make attempt, so it's easier to just rename the files, and rerun make
It then compiles successfully-- though it doesn't create files in /usr/local/bin like the documentation says, the files are created in key77b/bin. The program runs under x, so startx if it's not running already.
The key77b/doc file has tutorials, as well as other documentation-- the multiport one was useful.
Initially I the program was seg faulting whenever i tried to get some sound. This turns out to have been an issue with my midi port setup. This is probably properly handled by creating a keylocal.k file but I haven't got that far yet. Adding the Port Enabler tool to the window, and using it to enable midi input and output prevented further segmentation faults.
To actually get midi doing something required I use the alsa tools to map keykit's ports to the system's midi ports.
I had an old Edirol UM-1 USB-midi cable which I plugged into the usb hub connected to the pi. With keykit running and the midi ports enabled, from a console command line
aconnect -i
lists the midi inputs
aconnect -o
lists the midi outputs
Both the UM-1 and keykit showed up, with a major/minor number.
aconnect 128:1 20:0
connects the midi in on keykit to the midi out of the UM-1. At this point I could connect my iphone (through yet another midi interface) and run Midi Monitor and see events generated by keykit's Mouse Matrix tool. Running BS-16i on the iphone let me hear stuff. BS-16i has a General Midi soundfont; very handy.
Using aplay midifile from the console was very handy getting this working.
aplaymidi -p20:0 filename
Once that was working, I connected the midi cable from the UM-1's output to my MeeBlip synthesiser, switched it to receive on channel 1, and spent a fun few hours playing with keykit.
Keykit's documents say it only works for external midi; but I imagine since they were written, the state of soft synths has advanced considerably; since the connection is handled by alsa, I don't see why it won't work.
Resources
- At the Sounding Edge: Introducing KeyKit is a Linux Journal article from 2005
Tags: raspberrypi, synth