e dot dot dot
a mostly about the Internet blog by

April 2026
Sun Mon Tue Wed Thu Fri Sat
     
   


Meta commits to 1 gigawatt of custom chips with Broadcom as Hock Tan decides to leave board

Furnished content.


Meta commits to deploying 1 GW of custom in-house MTIA chips codesigned with Broadcom in sweeping new multiyear deal announced Tuesday

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



NAACP sues Elon Musk's xAI over Memphis data center air pollution

Furnished content.


Elon Musk, who is the world's richest person, has been counting on the greater Memphis area to serve as the backbone for xAI's buildout.

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



Cramer: The market's biggest fears 'just didn't happen' - and that's why you can't leave the game

Furnished content.


CNBC's Jim Cramer explained why bailing on stocks when things look bleak ends up hurting you in the long run.

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



This simple email trick saves me from annoying marketing spam (and it's free to do)

Furnished content.


There's an easy way to curb ads and marketing emails in your inbox you've probably never thought of.

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



Making an Asynchronous Clocking Drum Machine App in Perl

Furnished content.


Let’s Make a Drum Machine application! Yeah! :DThere are basically two important things to handle: A MIDI “clock” and a groove to play.Why asynchronous? Well, a simple while (1) { Time::HiRes::sleep(); ... } will not do because the time between ticks will fluctuate, often dramatically. IO::Async::Timer::Periodic is a great timer for this purpose. Its default scheduler uses system time, so intervals happen as close to the correct real-world time as possible.

Clocks

A MIDI clock tells a MIDI device about the tempo. This can be handed to a drum machine or a sequencer. Each clock tick tells the device to advance a step of a measured interval. Usually this is very short, and is often 24 pulses per quarter-note (four quarter-notes to a measure of four beats).Here is code to do that, followed by an explanation of the parts:
#!/usr/bin/env perluse v5.36;use feature 'try';use IO::Async::Loop ();use IO::Async::Timer::Periodic ();use MIDI::RtMidi::FFI::Device ();my  = shift || 'usb'; # MIDI sequencer devicemy   = shift || 120; # beats per minutemy  = 60 /  / 24; # time / bpm / clocks-per-beat# open the named midi device for outputmy  = RtMidiOut->new;try { # this will die on Windows but is needed for Mac    ->open_virtual_port('RtMidiOut');}catch ($e) {}->open_port_by_name(qr/\Q/i);->start; # start the sequencer{INT} = sub { # halt gracefully    say "\nStop";    try {        ->stop; # stop the sequencer        ->panic; # make sure all notes are off    }    catch ($e) {        warn "Can't halt the MIDI out device: $e\n";    }    exit;};my  = IO::Async::Loop->new;my  = IO::Async::Timer::Periodic->new(   interval => ,   on_tick  => sub { ->clock }, # send a clock tick!);->start;->add();->run;
The above code does a few things. First it uses modern Perl, then the modules that will make execution asynchronous, and finally the module that makes real-time MIDI possible.Next up, a variable is captured for a unique MIDI device. (And to see what the names of MIDI devices on the system are, use JBARRETT’s little list_devices script.) Also, the beats per minute is taken from the command-line. If neither is given, usb is used for the name, and the BPM is set to “dance tempo.”The clock needs a time interval to tick off. For us, this is a fraction of a second based on the beats per minute, and is assigned to the variable.To get the job done, we will need to open the named MIDI device for sending output messages to. This is done with the provided.In order to not just die when we want to stop, {INT} is redefined to gracefully halt. This also sends a stop message to the open MIDI device. This stops the sequencer from playing.Now for the meat and potatoes: The asynchronous loop and periodic timer. These tell the program to do its thing, in a non-blocking and event-driven manner. The periodic timer ticks off a clock message every . Pretty simple!As an example, here is the above code controlling my Volca Drum drum machine on a stock, funky groove. We invoke it on the command-line like this:
perl clock-gen-async.pl

Grooves

What we really want is to make our drum machine actually play something of our own making. So it’s refactor time… Let’s make a 4/4 time groove, with 16th-note resolution, that alternates between two different parts. “4/4” is a “time signature” in music jargon and means that there are four beats per measure (numerator), and a quarter note equals one beat (denominator). Other time signatures like the waltz’s 3/4 are simple, while odd meters like 7/8 are not.In order to generate syncopated patterns, Math::Prime::XS and Music::CreatingRhythms are added to the use statements. “What are syncopated patterns?”, you may ask. Good question! “Syncopated” means, “characterized by displaced beats.” That is, every beat does not happen evenly, at exactly the same time. Instead, some are displaced. For example, a repeated [1 1 1 1] is even and boring. But when it becomes a repeated [1 1 0 1] things get spicier and more syncopated.The desired MIDI channel is added to the command-line inputs. Most commonly, this will be channel 9 (in zero-based numbering). But some drum machines and sequencers are “multi-timbral” and use multiple channels simultaneously for individual sounds.Next we define the drums to use. This is a hash-reference that includes the MIDI patch number, the channel it’s on, and the pattern to play. The combined patterns of all the drums, when played together at tempo, make a groove.Now we compute intervals and friends. Previously, there was one . Now there are a whole host of measurements to make before sending MIDI messages.Then, as before, a named MIDI output device is opened, and a graceful stop is defined.Next, a Music::CreatingRhythms object is created. And then, again as before, an asynchronous loop and periodic timer are instantiated and set in motion.The meaty bits are in the timer’s on_tick callback. This contains all the logic needed to trigger our drum grooves.As was done in the previous clock code, a clock message is sent, but also we keep track of the number of clock ticks that have passed. This number of ticks is used to trigger the drums. We care about 16 beats. So every 16th beat, we construct and play a queue of events.Adjusting the drum patterns is where Math::Prime::XS and Music::CreatingRhythms come into play. The subroutine that does that is adjust_drums() and is fired every 4th measure. A measure is equal to four quarter-notes, and we use four pulses for each, to make 16 beats per measure. This routine reassigns either Euclidean or manual patterns of 16 beats to each drum pattern.Managing the queue is next. If a drum is to be played at the current beat (as tallied by the variable), it is added to the queue at full velocity (127). Then, after all the drums have been accounted for, the queue is played with ->note_on() messages. Lastly, the queue is “drained” by sending ->note_off() messages.
#!/usr/bin/env perluse v5.36;use feature 'try';use IO::Async::Loop ();use IO::Async::Timer::Periodic ();use Math::Prime::XS qw(primes);use MIDI::RtMidi::FFI::Device ();use Music::CreatingRhythms ();my  = shift || 'usb'; # MIDI sequencer devicemy   = shift || 120; # beats-per-minutemy  = shift // 9; # 0-15, 9=percussion, -1=multi-timbralmy  = {    kick  => { num => 36, chan =>  < 0 ? 0 : , pat => [] },    snare => { num => 38, chan =>  < 0 ? 1 : , pat => [] },    hihat => { num => 42, chan =>  < 0 ? 2 : , pat => [] },};my  = 16; # beats in a measuremy  = 4; # divisions of a quarter-note into 16thsmy  = 24; # PPQNmy  = 60 /  / ; # time / bpm / ppqnmy  =  / ; # clocks per 16th-notemy %primes = ( # for computing the pattern    all  => [ primes() ],    to_5 => [ primes(5) ],    to_7 => [ primes(7) ],);my  = 0; # clock ticksmy  = 0; # how many beats?my  = 0; # part A or B?my @queue; # priority queue for note_on/off messages# open the named midi output devicemy  = RtMidiOut->new;try { # this will die on Windows but is needed for Mac    ->open_virtual_port('RtMidiOut');}catch ($e) {}->open_port_by_name(qr/\Q/i);{INT} = sub { # halt gracefully    say "\nStop";    try {        ->stop; # stop the sequencer        ->panic; # make sure all notes are off    }    catch ($e) {        warn "Can't halt the MIDI out device: $e\n";    }    exit;};# for computing the patternmy  = Music::CreatingRhythms->new;my  = IO::Async::Loop->new;my  = IO::Async::Timer::Periodic->new(    interval => ,    on_tick  => sub {        ->clock;        ++;        if ( % $sixteenth == 0) {            # adjust the drum pattern every 4th measure            if ( % ($beats * ) == 0) {                adjust_drums(, , \%primes, \);            }            # add simultaneous drums to the queue            for my  (keys %) {                if (->{}{pat}[  % $beats ]) {                    push @queue, { drum => , velocity => 127 };                }            }            # play the queue            for my  (@queue) {                ->note_on(                    ->{ ->{drum} }{chan},                    ->{ ->{drum} }{num},                    ->{velocity}                );            }            ++;        }        else {            # drain the queue with note_off messages            while (my  = pop @queue) {                ->note_off(                    ->{ ->{drum} }{chan},                    ->{ ->{drum} }{num},                    0                );            }            @queue = (); # ensure the queue is empty        }    },);->start;->add();->run;sub adjust_drums(, , , ) {    # choose random primes to use by the hihat, kick, and snare    my ($p, $q, $r) = map { ->{$_}[ int rand ->{$_}->@* ] } sort keys %;    if ($ == 0) {        say 'part A';        ->{hihat}{pat} = ->euclid($p, );        ->{kick}{pat}  = ->euclid($q, );        ->{snare}{pat} = ->rotate_n($r, ->euclid(2, ));        $ = 1; # set to part B    }    else {        say 'part B';        ->{hihat}{pat} = ->euclid($p, );        ->{kick}{pat}  = [qw(1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1)];        ->{snare}{pat} = [qw(0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0)];        $ = 0; # set to part A    }}
(You may notice the inefficiency of attempting to drain an empty queue 23 times every 16th note. Oof! Fortunately, this doesn’t fire anything other than a single while loop condition. A more efficient solution would be to only drain the queue once, but this requires a bit more complexity that we won’t be adding, for brevity’s sake.)On Windows, this works fine:
perl clocked-euclidean-drums.pl "gs wavetable" 90
To run with fluidsynth and hear the General MIDI percussion sounds, open a fresh new terminal session, and start up fluidsynth like so (mac syntax):
fluidsynth -a coreaudio -m coremidi -g 2.0 ~/Music/soundfont/FluidR3_GM.sf2
The FluidR3_GM.sf2 is a MIDI “soundfont” file and can be downloaded for free.Next, enter this on the command-line (back in the previous terminal session):
perl clocked-euclidean-drums.pl fluid 90
You will hear standard kick, snare, and closed hihat cymbal. And here is a poor recording of this with my phone:To run the code with my multi-timbral drum machine, I enter this on the command-line:
perl clocked-euclidean-drums.pl usb 90 -1
And here is what that sounds like:

The Module

I have coded this logic, and a bit more, into a friendly CPAN module. Check out the eg/euclidean.pl example program in the distribution. It is a work in progress. YMMV.

Credits

Thank you to Andrew Rodland (hobbs), who helped me wrap my head around the “no-sleeping asynchronous” algorithm.

To-do Challenges

  • Make patterns other than prime number based Euclidean phrases.
  • Toggle more than two groove parts.
  • Add snare fills to the (end of the) 4th bars. (here’s my version)
  • Make this code handle odd meter grooves.

Resources



Read more here

posted at: 12:00am on 15-Apr-2026
path: /Programming/Perl | permalink | edit (requires password)

0 comments, click here to add the first



A data removal service helped me reclaim my privacy - see if you need one, too

Furnished content.


Data removal services automate the removal of your information from the web, but their biggest benefit is something else.

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



I used the 'Plus Five' rule to fix my iPhone's slow wireless charging - here's how it works

Furnished content.


Wireless charging is a helpful feature, but you may not be getting the optimal speed with your accessories. Here's what to check for.

Read more here


posted at: 12:00am on 15-Apr-2026
path: /Technology | permalink | edit (requires password)

0 comments, click here to add the first



April 2026
Sun Mon Tue Wed Thu Fri Sat
     
   







RSS (site)  RSS (path)

ATOM (site)  ATOM (path)

Categories
 - blog home

 - Announcements  (0)
 - Annoyances  (0)
 - Career_Advice  (0)
 - Domains  (0)
 - Downloads  (3)
 - Ecommerce  (0)
 - Fitness  (0)
 - Home_and_Garden  (0)
     - Cooking  (0)
     - Tools  (0)
 - Humor  (0)
 - Notices  (0)
 - Observations  (1)
 - Oddities  (2)
 - Online_Marketing  (0)
     - Affiliates  (1)
     - Merchants  (1)
 - Policy  (0)
 - Programming  (0)
     - Bookmarklets  (1)
     - Browsers  (1)
     - DHTML  (0)
     - Excel  (1)
     - Javascript  (4)
     - PHP  (0)
     - PayPal  (1)
     - Perl  (45)
          - blosxom  (0)
     - Unidata_Universe  (22)
 - Random_Advice  (1)
 - Reading  (0)
     - Books  (0)
     - Ebooks  (0)
     - Magazines  (0)
     - Online_Articles  (3)
 - Resume_or_CV  (1)
 - Reviews  (2)
 - Rhode_Island_USA  (0)
     - Providence  (1)
 - Shop  (0)
     - Test-Store  (1)
 - Sports  (0)
     - Football  (0)
          - Cowboys  (0)
          - Patriots  (0)
     - Futbol  (0)
          - The_Rest  (0)
          - USA  (0)
 - Technology  (5038)
 - Windows  (1)
 - Woodworking  (0)


Archives
 -2026  April  (77)
 -2026  March  (179)
 -2026  February  (164)
 -2026  January  (189)
 -2025  December  (171)
 -2025  November  (172)
 -2025  October  (168)
 -2025  September  (157)
 -2025  August  (169)
 -2025  July  (161)
 -2025  June  (155)
 -2025  May  (157)
 -2025  April  (149)
 -2025  March  (164)


My Sites

 - Millennium3Publishing.com

 - SponsorWorks.net

 - ListBug.com

 - TextEx.net

 - FindAdsHere.com

 - VisitLater.com