Home  |  Linux  | Mysql  | PHP  | XML
From:zentara Date:Thu Dec 14 05:37:23 2006
Subject:Re: accessing midisport 2x2 using ALSA & MIDI::Music...
On Tue, 12 Dec 2006 08:32:29 -0500, rbolen@carolina.rr.com ("Rick
Bolen") wrote:

>My project was to use a perl script to generate random midi cc event values
>that would get sent out to a couple of midi light-dimmer strips (Light
>Master) I have (4 dimmers/strip) so I could have nice blinky Christmas
>lights. I was hoping to play around with different "equations" (fractal?) in
>calculating random intensity values to try and achieve visually interesting
>and "organic randomness".
>
>... maybe by Mardi Gras!
>Thanks for all the help,
>Rick

Sounds like a coll project.
Since you already have learned to generate soundcard.ph,
here is a routine to send out midi signals, which  you might try,
they require no modules. You can experiment with the
while(1) loop to change sounds, and the $device number
to get your usb midi out.

I hope it helps you beat the Christmas deadline. :-)

#!/usr/bin/perl
use warnings;
use strict;
use diagnostics;
use Fcntl;
require 'sys/soundcard.ph';

sysopen(SEQ_FH,'/dev/sequencer',O_WRONLY) or die $!;

#send_midi_bytes(0xc0,20);
#my $patchbytes = send_midi_bytes(0xc0, 2);
#print "patchbytes->$patchbytes\n";

#song change ???
#send_midi_bytes(0xf3,6);

#send note
#send_midi_bytes(0x90 + $channel - 1, $note_no, $velocity); 

while(1){
        for my $note (40..50){ 
    	send_midi_bytes(0xc0,123); #cool patch sound
	send_midi_bytes(0x90,$note,100);
    select(undef,undef,undef,.1);
     }
}


sub send_midi_bytes {
   print "@_\n";
   my $device = 1;
   my $stuff = pack('C*', 
	  (map {&SEQ_MIDIPUTC(), $_, $device,0 } @_ ) );
    
   my $bytes = syswrite(SEQ_FH, $stuff) or die $!;

  if (not $bytes) {
     die("Couldn't write to /dev/sequencer $!"
       );
   }
}

__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