Perl 6
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Implementation of the algorithm described in

Build Status


    use EuclideanRhythm;

    my $r = => 16, fills => 7);

    for $r.list {
        # do something if the value is True


This provides an implementation of the algorithm described in which is in turn derived from a Euclidean algorithm. Simply put it provides a simple method to distribute a certain number of "fills" (hits, beats, notes or whatever you want to call them,) as evenly as possibly among a number of "slots". The linked paper describes how, using this method, you can approximate any number of common rhythmic patterns (as well as not so common ones.)

You could of course use it for something other than generating musical rhythms: any requirement where a number of events need to be distributed over a fixed number of slots may find this useful.


Assuming you have a working installation of Rakudo perl 6 then you should be able to install this with zef:

zef install EuclideanRhythm

or if you have a local copy of this repository:

sef install .

in the directory you found this file.


This is a fairly simple module such that the scope for any egregious bugs is quite limited, however if you have any suggestions, patches or comment the feel free to leave a post at

Because it is quite simple in both scope and implementation I would anticipate that any higher level functionality (such as providing timing,) would be implemented in another module.

Licence and Copyright

This is free software. Please see the LICENCE file in the distribution.

© Jonathan Stowe 2016, 2017