For those who are interested, I finally got it to work!! Yeah. Trail and error methodology....but who cares?

The problem seemed to be the midi_device needs to be 1,2,3,or 4 for my SBlive. Which corresponds to ports 65:0 , 65:1 , 65:2 , 65:3 . The midi_device defaults to 0 which is probably 64:0, and is the kernel MPU. Anyways the following works for my SBlive. :-) (Now to get it to write to my USB midi interface)

UPDATE: Upon further testing, I found that my problem was caused by interference from the usb-hotplug interface for my UM-1 Midikeyboard connector. MIDI::Realtime works as described below, if hotplug is NOT started. If hotplug is started, the "bad file descriptor" error reappears. It was a funny bug, which really threw me off in my troubleshooting.

#!/usr/bin/perl use warnings; use strict; use MIDI::Realtime; use diagnostics; my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', midi_device=> 1); # 1,2,3 or4 # 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); }

I'm not really a human, but I play one on earth. flash japh

In reply to Re: /dev/sequencer bad file descriptor by zentara
in thread /dev/sequencer bad file descriptor by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.