Evolution Electronics Ltd.

Linux and USB Keyboards

Statement

Evolution Electronics Ltd. does not yet officially support Linux but this document written by michael.martin@evolution.co.uk should cover the basics of getting your USB MK Evolution Keyboard set-up working in Linux.

This document only covers using your Evolution USB Keyboard with ALSA, not OSS since it's now really considered obsolete.

To the best of our knowledge, this won't work if you're using an ISA Soundcard. If your PC is less than 4 years old or 4 years old, you're probably not using an ISA Soundcard, which is good because they are old and slow.

Get the pdf version of this document.

Firstly, if you think setting up your Evolution keyboard in Linux is easy, think again; but it's not impossible.

Tested 'safe' Distributions

The following Linux distributions have been tested following this documentation to the letter:

  • SuSE Linux 8.0

  • RedHat Linux 7.3

Failed Tested Distributions

Mandrake Linux 8.2 failed the test, using this documentation. If anyone can get ALSA and USB MIDI working on Mandrake, please let me know, email ;.

Download Drivers

At the moment USB-MIDI support in Linux is quite young and probably isn't included in your distribution.

e.g. If you are running:

  • SuSE Linux 8.0

  • Redhat Linux 7.3

  • Debian 2.2.x

or lower, then you will definitely need to download the latest drivers.

The Advanced Linux Sound Architecture project is the project which creates the most widely used Linux Audio drivers (ALSA). You can download their latest drivers from www.alsa-project.org. At the time of writing, the latest version is 0.9.0rc3.

From the ALSA website, you'll need to download the following packages:

  1. alsa-driver-x.x.x.tar.bz2 (at the time of writing: alsa-driver-0.9.0rc3.tar.bz2). This can be found usually in the 'driver' directory of the FTP server.

  2. Alsa-lib-x.x.x.tar.bz2 (time of writing: alsa-lib-0.9.0rc3.tar.bz2. This can usually be found in the 'lib' directory of the FTP server.

  3. Alsa-utils-x.x.x.tar.bz2 (time of writing: alsa-utils-0.9.0rc3.tar.bz2. This can be found in the 'utils' directory of the FTP server.

  4. Alsa-tools-x.x.x.tar.bz2 (time of writing: alsa-tools-0.9.0rc1.tar.bz2. This can be found in the 'tools' directory of the FTP server.

Other useful applications include 'alsa-tools' found in the 'tools' directory of the FTP server. Another good idea is to do a Google search for a program called: 'aseqview'. This is a GTK/Gnome program for monitoring MIDI signals which will be useful later on.

Check your Libraries

It is important that you have the correct libraries installed, since most of the ./configure errors or because you haven't installed the right libraries for ALSA to compile. Almost all of the problems you probably will encounter setting up your keyboard in Linux will be driver related, I can guarantee it.

It is mandatory that you install the Linux Kernel sources and header files from your distro (distribution).

I recommend you install your distributions “Software Development” section. If you didn't install the “Software Development” system then good luck because this document does not contain a list of all the dependent programs that ALSA needs. To test whether you have “Software Development” tools installed, type 'gcc' at the command line, if an application loads then you might be in with a chance!

Before you go any further

You must be brave, expect problems and realise that this won't kill your Linux sound for ever.

Go to the command line, type su. Then enter your root password.

Then type: /etc/init.d/alsasound stop

This will stop your current ALSA.

Assuming you have installed the right development packages like GCC, G++ make, etc.etc. You should be safe to continue; the ALSA site, www.alsa-project.org might cover what you need to compile ALSA.

Configure and Compiling

Now comes the fun part, configuring and compiling all your downloads. Please try to follow this to the letter.

ALSA Driver

At the command line, in the same directory where you've download your ALSA packages, do the following.

mike@linux %> tar -jxvf alsa-driver-0.9.0rc3.tar.bz2

This will extract the bz2 archive into a new directory. Go into that directory (try cd alsa-d then [TAB]. This will fill-in the directory name. Please take an effort to read both the README file (type kedit README &) and the INSTALL file since you'll find a lot of tips there.

Please then go into the include/linux directory and remove a file called isapnp.h. You can do this by typing:

mike@linux %> cd include/linux

mike@linux %> rm isapnp.h

You're now ready to configure the ALSA source, do:

mike@linux %> ./configure

This will configure ALSA. If the configure process complains, check you have the appropriate libraries installed. If you see lots of long text flashing through the screen this is normal, so don't worry.

If you receive any errors other than ones library related (i.e. “Segmentation Fault”), try re-installing the kernel sources on your distribution CD and running:

mike@linux %> make clean

mike@linux %> rm config.status

mike@linux %> rm config.cache

mike@linux %> ./configure (start again)

You now need to compile the ALSA Driver. Simply do:

mike@linux %> make

Now wait a very long time. If you receive any errors other than ones library related (i.e. “Segmentation Fault”), try re-installing the kernel sources on your distribution CD and running:

mike@linux %> make clean

mike@linux %> rm config.status

mike@linux %> rm config.cache

mike@linux %> ./configure (start again)

mike@linux %> make


If you're still having problems then try contacting the user groups about your problem (see Appendices).

Now you need to install the drivers. You can do this by typing at the command line:

mike@linux %> su

Password: (Your root password)

linux:#> make install

Some more text will appear and the drivers will install. If you don't know your root password then please try to find it out, since you can't make any worth while changes to your soundcard configuration without it.

You need to install the correct devices for ALSA to work. You only need to do this once. In the ALSA Drivers directory, type:

mike@linux %> ./snddevices

This will setup the correct devices for ALSA to use.

Now type:

linux:#>exit

Which should bring you back to the user level:

mike@linux %>

ALSA Libraries (ALSA Libs)

After successfully compiling the ALSA Drivers, it's now time to compile the libraries. Because you've compiled the drivers successfully, compiling the ALSA Libs should be less troublesome because you've probably got all the prerequisites (dependencies) installed.

In the same fashion as before (but this time for the Libs) do:

mike@linux %> tar -jxvf alsa-lib-0.9.0rc3.tar.bz2

Then 'cd' into alsa-lib-0.9.0rc3 and type:

mike@linux %> ./configure -–with-sequencer=yes -–with-oss=yes

(If you get any errors, then follow the same procedure as when you received errors in compiling the ALSA Drivers)

Compile:

mike@linux %> make

Install:

mike@linux %> su

Password: (Your root password)

linux:#> make install

Some more text will appear and the drivers will install. If you don't know your root password then please try to find it out, since you can't make any worth while changes to your soundcard configuration without it. Now type:

linux:#>exit

mike@linux %>

ALSA Utilities (ALSA Utils)

The ALSA Utilities follow the same, common procedure.

Do:

mike@linux %> tar -jxvf alsa-utils-0.9.0rc3.tar.bz2

Then 'cd' into alsa-utils-0.9.0rc3 and type:

mike@linux %> ./configure

(If you get any errors, then follow the same procedure as when you received errors in compiling the ALSA Drivers/Libs)

Compile:

mike@linux %> make

Install:

mike@linux %> su

Password: (Your root password)

linux:#> make install

Some more text will appear and the drivers will install. If you don't know your root password then please try to find it out, since you can't make any worth while changes to your soundcard configuration without it. Now type:

linux:#>exit

mike@linux %>

ALSA Tools

ALSA Tools will take the longest to do because it's got the most programs in.

mike@linux %> tar -jzxvf alsa-tools-0.9.0rc1.tar.bz2

This will extract the source. Then do 'ls'; you can see the amount of applications to install. For the purposes of getting your keyboard up running a virtual instrument (the default OPL3), we'll only cover the 'sbiload' utility. Do:

mike@linux %> cd seq/sbiload

You can check the README file. Now do:

mike@linux %> ./configure

mike@linux %> make

mike@linux %> su

Password: (Your root password)

linux:#> make install

Some more text will appear and the tools will install. If you don't know your root password then please try to find it out, since you can't make any worth while changes to your soundcard configuration without it. Now type:

linux:#>exit

mike@linux %>

ALSA Sequencer Viewer (aseqview) [optional]

You don't need this program if you don't want to but this is a visual way of checking whether you are receiving a MIDI Input from your USB MIDI Device.

You'll definitely need the GTK Libraries install (this means X aswell). If you're running GNOME and/or Abiword, you've got them installed. You'll need to make sure you've got the GTK (or GNOME) development libraries installed. If you've installed the “Software Development” section you should be OK. Now follow the common procedure of compiling and installing.

Do:

mike@linux %> tar -jxvf aseqview-0.1.4.tar.bz2

Then 'cd' into aseqview-0.1.4 and type:

mike@linux %> ./configure

If you receive any errors other than ones library related (i.e. “Segmentation Fault”), try re-installing the kernel sources on your distribution CD and running:

mike@linux %> make clean

mike@linux %> rm config.status

mike@linux %> rm config.cache

mike@linux %> ./configure (start again)

Compile:

mike@linux %> make

Install:

mike@linux %> su

Password: (Your root password)

linux:#> make install

Some more text will appear and the drivers will install. If you don't know your root password then please try to find it out, since you can't make any worth while changes to your soundcard configuration without it. Now type:

linux:#>exit

mike@linux %>

To check, run:

mike@linux %> ./aseqview –-help (in the Aseqview directory)

Post Installation

Editing the /etc/modules.conf file

You will now need to perform some very specific tasks.

As root (super-user), you'll need to edit the /etc/modules.conf file (this is dangerous but be brave)!

If you're using RedHat Linux 7.3, 'rem' out (using the # key) any mention of anything audio related e.g.

'#post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L >/dev/null 2>&1 ||:'

even alias lines. It's a good idea to rem out lines rather than deleting them in case you've done something wrong.

Do NOT rem out 'alias usb-controller usb-uhci'

Making a Decision

You have to make a decision before continuing. At the time of writing, sequencers like the Rosegarden Sequencer can only receive an input from the first available ALSA MIDI Input device. This means you will have to set up the keyboard as your first “soundcard” device and your soundcard as your second soundcard device. This is only a problem when you want to play sound using the OSS Emulation layer that ALSA provides because this emulation layer only plays sound on the first available soundcard!

--Make a decision as to what you want to be the first soundcard device. The example below has the soundcard (in this case it's a cmipci type soundcard) as the top device, but in Appendix B, there is an example of the the USB MIDI device as the first soundcard.

Now you have decided what you want, add the following lines:

#Mike's Modified Lines:

#Device Specific Stuff

alias char-major-116 snd

alias char-major-14 soundcore

#OSS Specific Stuff

alias sound-service-0-0 snd-mixer-oss

alias sound-service-0-1 snd-seq-oss

alias sound-service-0-3 snd-pcm-oss

alias sound-service-0-8 snd-seq-oss

alias sound-service-0-11 snd-mixer-oss

alias sound-service-0-12 snd-pcm-oss

#ALSA Specific Stuff

##Sound Card Limits

options snd snd_major=116 snd_cards_limit=3

##Aliases to sound cards

alias snd-card-2 snd-usb-midi

alias snd-card-1 snd-usb-audio

alias snd-card-0 snd-<soundcard type>

##Sound Index Options

options snd-usb-midi snd_index=2

options snd-usb-audio snd_index=1

options snd-<soundcard type> snd_index=0

##Set Sound card Slots up

alias sound-slot-0 snd-card-0

alias sound-slot-1 snd-card-1

alias sound-slot-2 snd-card-2


and save the /etc/modules.conf file. To be safe, type “reboot” as super user.

After Reboot

Check the Kernel System Log

After you have rebooted, unplug and re-plug your Keyboard1, then check the system log to see if the USB device has been recognized. You can do this only as root and by opening /var/log/messages up in your favourite text editor (it's a very big file). Go to the date and time you re plugged your keyboard. It should say something like:

Aug 29 12:02:39 linux kernel: hub.c: USB new device connect on bus1/1, assigned device number 3

Aug 29 12:02:39 linux kernel: snd-usb-midi: using interface 1

Aug 29 12:02:39 linux kernel: snd-usb-midi: MIDIStreaming version 01.00

Aug 29 12:02:39 linux kernel: snd-usb-midi: detected 1 input jack(s) on endpoint 1

Aug 29 12:02:39 linux kernel: snd-usb-midi: detected 1 output jack(s) on endpoint 2

Aug 29 12:02:39 linux kernel: snd-usb-midi: detected Evolution Electronics Ltd. MK-249 USB MIDI keyboard

Aug 29 12:02:39 linux kernel: snd-usb-midi: endpoint 1: created 0 output and 1 input ports

Aug 29 12:02:39 linux kernel: snd-usb-midi: endpoint 2: created 1 output and 0 input ports

Aug 29 12:02:40 linux kernel: usb.c: registered new driver audio

Aug 29 12:02:40 linux kernel: audio.c: v1.0.0:USB Audio Class driver

Aug 29 12:02:40 linux insmod: Using /lib/modules/2.4.18-4GB/kernel/drivers/usb/audio.o

Aug 29 12:02:40 linux insmod: Symbol version prefix ''

Check ALSA

You can now check to see if the ALSA drivers have been installed. Type:

mike@linux %> aconnect -o

The Output should be something like:

client 64: 'external MIDI 0' [type=kernel]

0 'MIDI 0-0'

client 65: 'OPL3 FM synth' [type=kernel]

0 'OPL3 Port'

client 80: 'Evolution Electronics Ltd. MK-249 USB keyboard' [type=kernel]

1 'MK-248 USB keyboard Port 1'

Don't worry if the numbers aren't the same as in this example.

Check with Aseqview

You can also check to see if you're getting an input with aseqview – If you compiled and installed it. Make sure that aseqview is running with the rights alsa port numbers. Type aseqview –-help for information, in this case it would be:

mike@linux %> aseqview -s80:0 -d65:0

This is because client 80, port 0 is my MK-249 and client 65, port 0 is my OPL3. If you don't hear anything but you can see signals when you hit a key on your Evolution Keyboard then you need to 'sbiload' your OPL3 synth instrument (covered next).

Setting up your OPL3 synth

The OPL3 synth comes default with ALSA. To use it, you will need to type (where: p65:0, you will need 65:0 to be the client:port of your OPL3 (to find the client port of your OPL3, type 'aconnect -o').

On SuSE:

mike@linux %> sbiload -p65:0 --opl3 /usr/share/sounds/opl3/std.o3 /usr/share/sounds/opl3/drums.o3

On RedHat:

mike@linux %> sbiload -p65:0 --opl3 /etc/midi/std.o3 /etc/midi/drums.o3

On Mandrake:

mike@linux %> sbiload -p65:0 --opl3 /usr/share/sounds/opl3/std.o3 /usr/share/sounds/opl3/drums.o3

Connecting with ALSA

ALSA works by making connections between instruments, so in order get a sound out all the time you can use aconnect or (if you're distribution's got it) kaconnect or aconnectgui.

Getting Help

If you are having trouble setting up your Evolution keyboard under Linux, there is help available. Take a look at the ALSA Documentation, available at www.alsa-project.org, and/or you can join the ALSA user group at Sourceforge. You can do this by going to www.alsa-project.org and finding the Mailing Lists section.

1You don't need to do this, but the system logs will be clearer, since all the USB specific stuff is displayed together, instead of spread out in the boot time area of the log.