Re: MIDI::Realtime and sblive with linux
[email protected] (zentara) Sat, 19 Jun 2004 11:27:33 -0400
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <[email protected]> |
On 18 Jun 2004 13:04:18 -0000, [email protected] (Perldiscuss - Perl Newsgroups And Mailing Lists) wrote: >Hi, I have the same problem here on 2.4.18, perl5.6. >Can I ask you why you dont think the problem in soundcard.ph is the real >cause? >PLEASE, if you managed to solve the problem, let me know how => >[email protected] >Zentara wrote: > >> Hi, >> I'm using linux 2.4.20, perl5.8, with alsa, and a sblive soundcard. > >> My midi plays fine. >> I can play a midi with "pmidi -p65:0 somefile.mid" > >> I can also use timidity by itself or as a server to >> play midi files. > >> But I can't get Realtime::MIDI to play, and was wondering >> if anyone knows where I should look. > >> The script below gives me a warning: >> "Operator or semicolon missing before &__foo_bar___ at (eval 471) line1. >> Ambiguous use of & resolved as operator & at (eval 471) line 1." > >> But I don't think that is the cause . Hi, thanks for reminding me of this, I went back and tried again and although it isn't working, I'm getting closer. :-) I'm using kernel 2.4.22 and Alsa 1.0.4., and Perl 5.8.3 So the soundcard.h problem dosn't appear anymore, but when I try to run the module's example code, I get the error: "Couldn't write to /dev/sequencer, bad file descriptor at (....)Realtime.pm line 201. Line 201 is in this sub: ############################################### sub 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; } ######################################################### The code I'm trying to run is: #!/usr/bin/perl use warnings; use strict; use MIDI::Realtime; my $midi = MIDI::Realtime->new(); # 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); } __END__ ############################################ So I'll dig somemore, but if anyone knows how to setup the right file descriptor, please edify us. :-) -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html