Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    MIDI::Simple::Drummer 0.02

    Download button

    No screenshots available
    Downloads: 116  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Gene Boggs | More programs
    Perl Artistic License / FREE
    November 19th, 2011, 13:59 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    MIDI::Simple::Drummer description

    Glorified metronome

    MIDI::Simple::Drummer is a "robotic" drummer that provides simple methods to make beats.

    This is not a "drum machine" that you control in a traditional, mechanical sense. It is intended to be a "sufficiently intelligent" drummer, with which you can practice, improvise, compose, record and experiment.

    These "beats" are entirely constructed with perl and as such, any method can be used to generate the phrases - Stochastic, Evolutionary, L-system, Recursive descent grammar, Bayseian, Markov, Quantumm::Whatever...

    Note that you, the programmer, should know what the patterns and kit elements are named and what they do. For these, check out the source of this package, the included style subclass(es), the eg/* files and the .mid files they produce.

    The default kit is the exciting, general MIDI drumkit. Fortunately, you can import the .mid file into your favorite sequencer and assign better patches. Voilà !

    SYNOPSIS

     # A glorified metronome:
     use MIDI::Simple::Drummer;
     my $d = MIDI::Simple::Drummer->new(-bpm => 100);
     $d->count_in;
     for(1 .. $d->phrases * $d->bars) {
     $d->note($d->EIGHTH, $d->backbeat_rhythm(-beat => $_));
     $d->note($d->EIGHTH, $d->tick);
     }

     # Shuffle:
     use MIDI::Simple::Drummer;
     my $d = MIDI::Simple::Drummer->new(-bpm => 100);
     $d->count_in;
     for(1 .. $d->phrases * $d->bars) {
     $d->note($d->TRIPLET_EIGHTH, $d->backbeat_rhythm(-beat => $_));
     $d->rest($d->TRIPLET_EIGHTH);
     $d->note($d->TRIPLET_EIGHTH, $d->tick);
     }

     # A rock drummer:
     use MIDI::Simple::Drummer::Rock;
     $d = MIDI::Simple::Drummer::Rock->new(-bpm => 100);
     my($beat, $fill) = (0, 0);
     $d->count_in;
     for my $p (1 .. $d->phrases) {
     if($p % 2 > 0) {
     $beat = $d->beat(-name => 3, -fill => $fill);
     }
     else {
     $beat = $d->beat(-name => 4);
     $fill = $d->fill(-last => $fill);
     }
     }
     $d->patterns(fin => \&fin);
     $d->beat(-name => 'fin');
     $d->write;
     sub fin {
     my $d = shift;
     $d->note($d->EIGHTH, $d->option_strike;
     $d->note($d->EIGHTH, $d->strike('Splash Cymbal','Bass Drum 1'));
     $d->note($d->TRIPLET_SIXTEENTH, $d->snare) for 0 .. 2;
     $d->rest($d->SIXTEENTH);
     $d->note($d->EIGHTH, $d->strike('Splash Cymbal','Bass Drum 1'));
     }

     # Multi-tracking:
     use MIDI::Simple::Drummer;
     my $d = MIDI::Simple::Drummer->new;
     $d->sync_tracks(
     sub { $d->beat(-name => 'b1') },
     sub { $d->beat(-name => 'b2') },
     );
     $d->write();
     sub b1 { # tick
     my $self = shift;
     my %args = @_;
     my $strike = $self->tick;
     $self->note($self->QUARTER(), $strike) for 1 .. $self->beats;
     return $strike;
     }
     sub b2 { # kick
     my $self = shift;
     my %args = @_;
     my $strike = $self->kick;
     $self->note($self->QUARTER(), $strike) for 1 .. $self->beats;
     return $strike;
     }



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    glorified metronome | Perl module | Perl | glorified | metronome

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM