Back to Home

Sequencer for polyrhythms in Max / MSP

MaxMSP · Sequencer · Sequencers · Algorithmic Composition

Sequencer for polyrhythms in Max / MSP

    What do I know about polyrhythms? Not very much; it seems that this is when two or more rhythms of different sizes are played simultaneously, and they are played at the same time. I will give a picture for clarity.

    Two rhythms of different sizes are played in one time.

    This technique is used in the ethnic music of the inhabitants of the African continent, as well as by many good drummers. This article will describe the method that I use to generate such rhythms.

    Tools


    Rhythms can be visualized as a sequence of ones and zeros, where 1 is a beat and 0 is silence. The total number of elements determines the length of the rhythm. In max, it’s easiest to imagine the rhythm in this way with the help of messages:

    Rhythms represented as a set of zeros and ones

    In the first rhythm there are 16 elements, in the second - 10 . We will play them using the object seq ~ . It works as follows: we sequentially hammer events, for each of which we determine the condition under which it will be displayed. seq ~ receives an audio signal, compares its value with the entered data, and if it matches, displays the saved message. For example, make the object return bangwhen the value of the incoming signal will be 0.5 . To do this, send a message to seq ~ (add my_rythm 0.5 bang) . Now, when the value of the signal entering seq ~ is equal to 0.5 , the object will give out bang through the left outlet. To facilitate understanding of the operation of the object, I created a small patch with comments, which should help to understand its work (seqhowto.maxpat) .

    Hope this patch helps

    We go further. At the moment, we need to drive a sequence of ones and zeros into the object seq ~ . For this purpose, some time ago I created a small abstraction called rtoseq(rhythm to seq ~) . Abstractions in max are called patches created so that they can be used as objects, for programmers this is called reusable code . Abstractions have the same .maxpat extension and can be added just like objects.

    Rtoseq internals

    The principle of rtoseq is very simple. It takes a list of ones and zeros, iterates through each element and for each unit generates a message that creates an event in seq ~ . I will not explain in detail his work, since this is an article about polyrhythms, and who cares, he will be able to make out what's what in 15 minutes.
    So, take a look at the following patch (polyrhythms01.maxpat) :

    polyrhythms01.maxpat

    When you click on a message, the rtoseq object “hammers” the rhythm into seq ~ objects , the signal from phasor ~ controls the output of messages stored in seq ~ . A message (play 1, seq rtoseq) is required to enable seq ~ (for details, go to the help).

    However, setting the rhythm directly through the message is not very convenient, so we will make a small interface (polyrhythms02.maxpat) . With each editing, the multislider

    polyrhythms02.maxpat

    object sends a list of values ​​of all sliders through the left outlet . The message (size $ 1) changes the number of sliders. The following changes have been made to the site inspector:
    Range: 0. 1. - the range of sliders;
    Slider Style: Bar - the appearance of the sliders;
    Sliders Output Values: Integer - in the sliders will be integer values;
    Thin Line Thickness: 2 - create the distance between the sliders.
    Thus we turn the multislider into a kind of pattern editor.

    Conclusion


    This method gives us not only the ability to program any polyrhythms, but also provides rich opportunities for experiments if we control seq ~ objects not with a saw, but with an arbitrary audio signal: a sine wave, a triangle, white noise, and even a linear signal Entrance - there are many options.

    By the way, this is the first article on pattr , which addresses the topic of algorithmic sequencers.

    PS Yes, on screens sixth max :)

    Archive with patts pattr.ru/sites/default/files/pattr_polyrhythms.zip I

    recorded a video at the request of commentators

    Read Next