Anyways the module seems to install OK, but when I try to run the module's sample code, I get an error:
So the code block generating the error is:"Couldn't write to /dev/sequencer, bad file descriptor at (....)Realtime.pm line 201.
and the sample code I'm trying to run issub send_midi_bytes { my $self = shift; my $device = $self->midi_device; my $stuff = pack('C*', (map {&SEQ_MIDIPUTC(), $_, $device, 0 } @_ ) ); my $bytes = syswrite(SEQ_FH, $stuff); if (not $bytes) { die("Couldn't write to " . $self->dev . ": $!" ); } return $bytes; }
So anyone know how to get the right file descriptor?#!/usr/bin/perl use warnings; use strict; use MIDI::Realtime; my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', midi_device=> 0); # Play note 47 with maximum velocity on channel 1 $midi->note(47, 127, 1); # 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); }
In reply to /dev/sequencer bad file descriptor by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |