LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Rick Bolen Date: Fri Dec 8 08:39:45 2006 Subject: RE: accessing midisport 2x2 using ALSA & MIDI::Music...
Thanks zentara. I'll try your suggestion. I had read your posts on experimenting with MIDI::Realtime previously. Ultimately I need to send CC events out the port, which I don't know if MIDI::Realtime supports, but for testing I can use note events. I tried installing OSS-Compat (alsa <-> oss), but it didn''t change anything (although I didn't config anything in it either). Regards, 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 |