Simple MIDI question

OSS specific Linux discussion (x86/amd64)

Moderators: cesium, dev, kodachi, hannu

Simple MIDI question

Postby mark_melvin » Mon Jun 14, 2010 3:20 am

Hi There,

I have been researching for about 4 hours now with no luck. I am trying to get a simple USB MIDI interface working on my Ubuntu Linux 10.04 machine.

I have an M-Audio Delta 44 sound card which I could not make work for the life of me...until I installed OSS (I've removed PulseAudio and I am not looking back). Then things just started working beautifully. Given that small triumph, I then wanted to get my MIDI interface working. I have a Create E-MU XMidi 2x2. When I plug it into my machine, and do an 'lsusb', I get the following output:

Bus 002 Device 005: ID 046d:c041 Logitech, Inc. G5 Laser Mouse
Bus 002 Device 004: ID 041e:3f08 Creative Technology, Ltd
Bus 002 Device 003: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard
Bus 002 Device 002: ID 4348:5584 WinChipHead CH34x printer adapter cable
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 007: ID 0644:0200 TEAC Corp.
Bus 001 Device 005: ID 0424:2504 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It is there, second in the list. If I unplug it, that entry goes away. So the OS sees the device, but I can't seem to do anything with it. It does not appear in JACK (which is set to use the OSS driver), or in any of the MIDI programs I have installed, so I assume I need to load some sort of driver to make it usable. I read somewhere that doing a 'cat /dev/midi' will allow me to see that it is working, but when I attempt that, I get the following error:

cat: /dev/midi: Device or resource busy

Running 'fuser' reveals nothing locking the resource.

Anyway, from I am really hoping I can make this work without involving ALSA at all. I have tried configuring JACK to use the ALSA driver, and when I do that I then get the option to configure the MIDI driver (it is disabled when the OSS driver is selected), but every combination of options on the ALSA driver fails for me. JACK simply won't start as it can't find the sound card device, so I can never try the MIDI end of things.

Any ideas here? Is this going to be possible with OSS? For more info, here is what 'lsmod' looks like:


Module Size Used by
binfmt_misc 6587 1
ppdev 5259 0
oss_usb 104132 0
oss_envy24 165571 0
osscore 557781 2 oss_usb,oss_envy24
usblp 10481 0
psmouse 63245 0
nvidia 9932176 38
agpgart 31724 1 nvidia
vga16fb 11385 0
vgastate 8961 1 vga16fb
dell_wmi 1793 0
dcdbas 5422 0
i2c_nforce2 5199 0
serio_raw 3978 0
lp 7028 0
parport 32635 2 ppdev,lp
fbcon 35102 71
tileblit 2031 1 fbcon
font 7557 1 fbcon
bitblit 4707 1 fbcon
softcursor 1189 1 bitblit
uvesafb 22297 1
usbhid 36110 0
hid 67032 1 usbhid
ohci1394 26950 0
usb_storage 39425 0
tg3 109292 0
pata_amd 8766 0
ieee1394 81181 1 ohci1394
sata_nv 19440 2

And here is ossinfo (I realize I am using /dev/oss/oss_envy240/pcm1 as my default output - that is intentional). There is no mention of MIDI devices here, so obviously OSS has a problem with my current configuration:

Version info: OSS 4.2 (b 2003/201005280201) (0x00040100) TRIAL
Platform: Linux/i686 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 (dweezil-l)

Number of audio devices: 7
Number of audio engines: 11
Number of MIDI devices: 0
Number of mixer devices: 3

Device objects
0: osscore0 OSS core services
1: oss_envy240 M Audio Delta 44 interrupts=173073 (173075)
2: oss_usb0 USB audio core services
3: usb041e3f08-0 USB sound device
4: usb041e3f08-1 USB sound device
5: usb041e3f08-2 USB sound device
6: usb041e3f08-3 USB sound device

MIDI devices (/dev/midi*)

Mixer devices
0: M Audio Delta 44 (Mixer 0 of device object 1)
1: USB sound device (Mixer 0 of device object 3)
2: USB sound device (Mixer 0 of device object 5)

Audio devices
M Audio Delta 44 out1/2 /dev/oss/oss_envy240/pcm0 (device index 0)
M Audio Delta 44 out3/4 /dev/oss/oss_envy240/pcm1 (device index 1)
M Audio Delta 44 in1/2 /dev/oss/oss_envy240/pcmin0 (device index 2)
M Audio Delta 44 in3/4 /dev/oss/oss_envy240/pcmin1 (device index 3)
M Audio Delta 44 input from mon. mixer /dev/oss/oss_envy240/mon (device index 4)
M Audio Delta 44 (all outputs) /dev/oss/oss_envy240/10ch_out (device index 5)
M Audio Delta 44 (all inputs) /dev/oss/oss_envy240/12ch_in (device index 6)

Nodes
/dev/dsp -> /dev/oss/oss_envy240/pcm1
/dev/dsp_in -> /dev/oss/oss_envy240/pcmin0
/dev/dsp_out -> /dev/oss/oss_envy240/pcm1
/dev/dsp_mmap -> /dev/oss/oss_envy240/pcm1
/dev/dsp_multich -> /dev/oss/oss_envy240/pcm1
mark_melvin
New Member
 
Posts: 4
Joined: Mon Jun 14, 2010 3:04 am

Re: Simple MIDI question

Postby cesium » Mon Jun 14, 2010 10:39 pm

OSS4 midi interface isn't really done yet, and I don't think any program supports it... Your best bet IMHO is an ugly one - remove oss_usb (edit /usr/lib/oss/etc/installed_drivers and remove "oss_usb" line), and use the ALSA drivers for the USB midi device.

For that to happen, we'll I suggest loading ALSA from /usr/lib/oss/soundon.user to make sure it's loaded after OSS (both because we don't want it to try attaching to the M-Delta, and becuase OSS "soundon" tries to get rid of ALSA. We can edit the soundon script to avoid that, but I think loading ALSA manually is easier).

You'll need to do the following:
Extract ALSA modules if needed from /lib/modules/$(uname -r)/sound-preoss.tar.bz2
Add a "modprobe" command for that appropriate ALSA module in soundon.user, and do "sudo chmod +x /usr/lib/oss/soundon.user" too. I think the correct modprobe is "modprobe snd-usb-audio".
Make sure the distro doesn't load ALSA first automatically, and make sure ALSA's OSS compat modules aren't loaded since they'll try to take over the OSS devices (except for sequencer compat which is safe. Not sure you want it though). The latter can be done by erasing the oss compat modules.

Alternatively, you can try loading ALSA before OSS. This will require getting rid of ALSA's OSS compat, ALSA's M-Delta driver, and editing /usr/sbin/soundon script to ignore ALSA.
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: Simple MIDI question

Postby mark_melvin » Tue Jun 15, 2010 1:44 am

Hey - thanks, a bunch for the comprehensive directions! I'll give this a shot and report back (unfortunately I can't get to it tonight).

M.
mark_melvin
New Member
 
Posts: 4
Joined: Mon Jun 14, 2010 3:04 am

Re: Simple MIDI question

Postby mark_melvin » Tue Jun 15, 2010 3:05 am

Hey cesium - one question. Do I need to extract all of /lib/modules/$(uname -r)/sound-preoss.tar.bz2? I tried just extracting the kernel/sound/usb/snd-usb-audio.ko and it doesn't work. Trying to run 'modprobe snd-usb-audio' just gives me the following error:

FATAL: Module snd_usb_audio not found.

M.
mark_melvin
New Member
 
Posts: 4
Joined: Mon Jun 14, 2010 3:04 am

Re: Simple MIDI question

Postby cesium » Tue Jun 15, 2010 5:07 am

There are some module dependencies in ALSA (soundcore, snd-usb-lib, and maybe some others). I suggest you extract all of the modules, then erase core/oss/ subdir (to avoid the OSS emulation).
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: Simple MIDI question

Postby mark_melvin » Tue Jun 15, 2010 12:11 pm

Sweet! After doing a 'depmod -a', I can load snd-usb-audio, and voila! my XMidi device is now in the list. And I can cat /dev/midi1, and see crap coming in on the midi port. I still can't access it in JACK, but I think I need to enable the ALSA sequencer perhaps. The major battle is won.
Anyway, thanks a lot for all of your help, cesium! I appreciate it!

Mark.
mark_melvin
New Member
 
Posts: 4
Joined: Mon Jun 14, 2010 3:04 am


Return to Linux

Who is online

Users browsing this forum: Bing [Bot] and 1 guest