Front page | perl.midi |
Postings from December 2006
RE: accessing midisport 2x2 using ALSA & MIDI::Music...
Thread Previous
|
Thread Next
From:
Rick Bolen
Date:
December 9, 2006 15:18
Subject:
RE: accessing midisport 2x2 using ALSA & MIDI::Music...
Message ID:
CDEKLJBDJHAEEAKNLEDACELLCPAA.rbolen@carolina.rr.com
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
Thread Previous
|
Thread Next