!/usr/bin/env perl

standard - generate a standard drum track

use 5.36.0;

use MIDI;

sub CHAN () { 9 }

sub NOW () { 0 }

sub VELO () { 100 }

sub BASS () { 36 } # try instead 35?

sub CLAP () { 39 }

sub HHAT () { 42 } # was 44

my $file = shift // 'standard.midi';

sub note ( $pitch, $velocity = VELO, $dur = 48, $chan = CHAN ) {

[ note_on => NOW, $chan, $pitch, $velocity ],

  [ note_off => $dur, $chan, $pitch, 0 ];

}

my @Events;

for ( 1 .. 16 ) {

# this is half a measure, so double the loops

push @Events, note(BASS), note(HHAT), note(CLAP), note(HHAT);

}

MIDI::Opus->new(

{ tracks => [ MIDI::Track->new( { events => \@Events } ) ] } )

->write_to_file($file);

Proxy Information
Original URL
gemini://thrig.me/music/midi/standard.pl
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
1036.73305 milliseconds
Gemini-to-HTML Time
0.419438 milliseconds

This content has been proxied by September (3851b).