Re: MIDI::Realtime works with ALSA
[email protected] (zentara) Sun, 20 Jun 2004 13:31:55 -0400
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 20 Jun 2004 13:29:12 -0400, zentara <[email protected]> wrote: Ooops, left a debugging comment in there. >So the following script works, (assuming you have successfully run >h2ph, (see man h2ph ) in order to get soundcard.ph. > >#!/usr/bin/perl >use warnings; >use strict; >use MIDI::Realtime; >use diagnostics; > #works but no sound out from card ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ should be #Works!!! > >my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', > midi_device=> 1); #1,2,3, or 4 ># 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); >} -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html