LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Rick Bolen Date: Sat Dec 9 19:54:16 2006 Subject: RE: accessing midisport 2x2 using ALSA & MIDI::Music...
Can't let this die... even though it's killing me! Midisport firmware is loading (via hotplug) and the 2x2's led pulses seductively. I resolved ::Realtime's last problems by running h2ph. Now the test script runs, but it reports: syswrite() on a closed file handle SEQ_FH at ...Realtime.pm line 198. ... Uncaught exception at user code: Couldn't write to /dev/sequencer: Bad file descriptor at ...Realtime.pm line 201. This all happens because unchecked sysopen() in ::Realtime.pm fails on the whatever I pass as dev (default = /dev/sequencer). I added a "die" statement there, and now that's where I fail. cat /proc/asound/cards & /devices lists info on the M2x2. When I connect the Midisport 2x2 to the usb port, how do I determine what device name and midi_dev number it is assigned by the system? Nothing is reported in logs except the usb assignments. Thanks, Rick > -----Original Message----- > From: Rick Bolen [mailto:rbolen@carolina.rr.com] > Sent: Saturday, December 09, 2006 6:16 PM > To: midi@perl.org > Subject: RE: accessing midisport 2x2 using ALSA & MIDI::Music... > > > > Both MIDI::Music and MIDI::Realtime CPAN packages are broken. ::Music > requires OSS as you said, and it has a dependency on a soundcard file. > > ::Realtime says it requires OSS, but its' package install is broken as > "make" and followers fail. > > I've tried it on Debian Sarge, Debian Testing and Suse 9.1. I > haven;t looked > into why the package is broken... it's been a long time since I understood > all perl module install stuff at a sufficiently granular level to > tshoot it. > > This part of linux (midi) is a mess and getting worse (with mixed > dependencies on OSS vs ALSA vs whatever). Maybe I'll get back to this one > day... > > Thanks for the suggestions, > > Rick > > > -----Original Message----- > > From: Linux@lists.develooper.com [mailto:Linux@lists.develooper.com]On > > Behalf Of zentara > > Sent: Friday, December 08, 2006 10:04 AM > > To: midi@perl.org > > Subject: Re: accessing midisport 2x2 using ALSA & MIDI::Music... > > > > > > On Thu, 7 Dec 2006 22:31:38 -0500, rbolen@carolina.rr.com ("Rick Bolen") > > wrote: > > > > >I'm trying to get MIDI::Music to send midi data out to the USB > connected > > >Midisport 2x2. Ifinally got the Midisport initialized via hotplug and > > >firmware dowloading, but... > > > > > >I'm using alsa on Debian testing, and MIDI::Music wants to write to > > > > MIDI::Musis says it needs OSS, not alsa. > > > > >/dev/music (which doesn't exist). I tried creating symlinks from > > /dev/music > > >to /dev/midi[0-3] but MIDI::Music still can't find the port. > > > > > >Any way to get the data moving? > > >Rick > > This is from testing a few years ago, I don't have a setup right now > > to test, but.............. > > > > If you just want to test the USB connection, it usually is device 5. > > This script uses MIDI::Realtime to play keys from the computer > > keyboard, but you can assign midi_device = 5 and maybe modify the > > loop, to get input from the midi keyboard. > > > > Also do "amidi -h" and google for amidi, to see how to do it > > with amidi. > > > > #!/usr/bin/perl > > use warnings; > > use strict; > > use MIDI::Realtime; > > use Term::ReadKey; > > > > ReadMode('cbreak'); > > > > #this works on linux with an SBlive, Alsa 1.0.4, kernel 2.4.22 > > # on my system, it has a bug when usb-hotplug and usb-midi are used > > # and the hotplug-blacklist is not setup properly > > > > my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', > > midi_device=> 5); #1,2,3,4 > > #5 for external keyboard > > #thru USB UM-1 connector > > > > while(1){ > > my $char; > > if (defined ($char = ReadKey(0)) ) { > > print ord($char),"\n"; # input was waiting and it was $char > > > > $midi->patch(ord($char)); #change instrument, 127 gives > > "exploding keyboard" :-) > > $midi->note(50,1,127); #play note > > > > } else { > > # no input was waiting > > } > > } > > > > > > ReadMode('normal'); # restore normal tty settings > > > > __END__ > > > > > > to send to the keyboard > > > > #!/usr/bin/perl > > use warnings; > > use strict; > > use MIDI::Realtime; > > use diagnostics; > > > > #works > > my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', > > midi_device=> 5); #1,2,3,4 > > #5 is USB midi > > # Play note 47 with maximum velocity on channel 1 > > $midi->note(47,1,127); > > > > # Now have some fun with randomness > > > > my @notes = (37 .. 50); > > # use all the channels (with extra drums) > > my @channels = (1 .. 16, 10, 10, 10); > > my @velocities = (70 .. 100); > > > > for (0 .. 127) { > > $midi->note($notes[rand(@notes)], > > $channels[rand(@channels)], > > $velocities[rand(@velocities)] > > ); > > > > # Wait for a tenth of a second > > select(undef,undef,undef, 0.10); > > } > > __END__ > > > > > > > > > > > > > > > > -- > > I'm not really a human, but I play one on earth. > > http://zentara.net/japh.html
| Navigate in group perl.midi at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |