Press a key and a midi note is sounded. My favorite is "r".
#!/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 my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', midi_device=> 1); #1,2,3,4 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__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: qwerty-keyboard realtime midi
by Juerd (Abbot) on Jun 21, 2004 at 20:53 UTC | |
by zentara (Cardinal) on Jun 22, 2004 at 11:54 UTC | |
by Juerd (Abbot) on Jun 22, 2004 at 12:25 UTC | |
by Ven'Tatsu (Deacon) on Jun 21, 2004 at 21:54 UTC | |
|