#!/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); }