Connect Midi Keyboard for Playback in Linux

By | 2012/04/22


Below is a simple how-to guide to use your USB midi keyboard in Linux to play some basic sounds back. I’ll show you some tips!


1. First, connect and power on your USB midi keyboard.


2. Next, on Debian or Ubuntu, install these packages which will pull in all related depedencies.

sudo apt-get install qjackctl qsynth

3. In a terminal, (or from your menu) run qjackctl. Here click on Setup and make two changes:

– enable Soft Mode
– Set Frames/Period to 512

Click Save at the top right to save a default.
(This will avoid qjackctl from displaying a ton of irrelevant errors and also avoid lag when you play your keyboard.)

01-linux-midi

Click on Start and leave qjackctl running.

02-linux-midi


4. Next, open a new terminal window (or from your menu) launch qsynth. Click on Setup, then Soundfonts. Here click on Open to choose the provided FluidR3_GM.sf2 soundfont. Once loaded, qsynth may prompt you to restart the engine. Click yes and leave qsynth open and running.

03-linux-midi
04-linux-midi
05-linux-midi
06-linux-midi


5. Now go back to qjackctl and click on the Connect button. Here go to the ALSA tab and click your MIDI input from your USB keyboard and drag with the mouse to connect it over the the FLUID Synth – Synth input port.

07-linux-midi
6. Play some notes on your MIDI keyboard and you should hear sound!


Troubleshooting tips

Verify the computer sees your USB midi keyboard connected by looking at the output of dmesg after plugging it in / turning it on:

$ dmesg
[100181.858667] usb 8-2: USB disconnect, device number 3
[100185.320181] usb 8-2: new full-speed USB device number 4 using uhci_hcd
[100185.524399] usb 8-2: New USB device found, idVendor=0763, idProduct=019c
[100185.524405] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[100185.524410] usb 8-2: Product: KeyStudio
[100185.524413] usb 8-2: Manufacturer: M-Audio

And lsusb should list your USB keyboard somewhere in the list:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 19ff:0102 Dynex 1.3MP Webcam
Bus 008 Device 002: ID 086a:0041 Emagic Soft- und Hardware GmbH 
Bus 009 Device 002: ID 046d:c313 Logitech, Inc. Internet 350 Keyboard
Bus 009 Device 003: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 008 Device 004: ID 0763:019c Midiman KeyStudio

Another note: Fully exit any other apps (video players, browser flash) that use audio while setting up and using your midi keyboard. It is possible to route everything through jack, but for simplicities sake, only run your qsynth app and no other audio-outputting apps.

Cool!

4 thoughts on “Connect Midi Keyboard for Playback in Linux

  1. Captain Planet

    Although this tutorial is almost 3 years old I want to say THANK YOU! I just bought a MIDI keyboard searched how to get it playing found this tutorial and it worked immediately.

    Reply
  2. Marie Isenburg

    Worked for me in Linux Mint too. Thanks very much.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.