Making a looper with Pure Data

I’ve been trying to make a simple looper with Pd for quite a while but I couldn’t find anything interesting on the web. It turns out that it is actually pretty simple to make one with Pure Data. It doesn’t require any fancy technique and it even works perfectly fine on a Raspberry Pi with a low latency.

Loopers were originally made with a piece of tape with both ends attached together so that it was playing continuously and repeatedly. By varying the length of the tape, one could get loops of different durations. Many layers of sound could be recorded on the same loop and result in rich, complex and sometimes eerie sounds. A very good example of what can be done musically with loops is the work of Brian Eno and Robert Fripp (on the album Evening Star, for instance). Loopers were the basis of Fripp’s Frippertronics. Another inspiration for me to use a looper is the French singer Camille, who does interesting stuff on stage with a digital device.  Looping is also sometimes called “sound on sound”.

The basis of the patch i’ve made is quite simple. The tape loop is replaced by a table in Pd, which is played continuously (that is, repeatedly). While this table is being played, the output and the input (from a microphone or a guitar) is also written to it. If there is no input (nothing is being recorded), the loop is being copied on itself (no changes). If there is some input, it gets added to the sounds that were already there in the loop. (There is an even simpler way to achieve this using a delay line with a feedback of 1, but you can’t empty it easily and loose other benefits of using tables in Pd).

GuitarExtended - Looper for guitar with Pure Data

There is one trick though. Pure Data processes the audio in blocks of samples (64 samples by default). Any audio event occuring during a block will only be taken into account at the beginning of the next block. The table’s length must thus be a multiple of the block size (64 in my patch), so that the end of the last block of the loop corresponds exactly to the beginning of the first block. If the table’s length is not a multiple of the block size, audible pops and clicks will appear while looping, and gradually turn into a very annoying noise if you record many layers. I have made a subpatch called [pd into-blocks] to take care of that.

There is nothing very special other than that. There is a subpatch to tap a new tempo, and i’ve added a limiter on both the input and the output to prevent audible distortion if you record too many layers. I’ve also added a “reverse” function that I find pretty cool, and you can also export your loop as a wav file if you’re very proud of it. You could of course use the recorded table in different ways, play it more slowly, etc.

Below is a quick example of what it sounds like (you can hear the different layers being recorded, the first one being reversed, and me playing on top of the loop).

The patch can be downloaded here.

This entry was posted in Simple effects, Uncategorized and tagged , , . Bookmark the permalink.

9 Responses to Making a looper with Pure Data

  1. Kevin says:

    Really nice guide! I found your blog a while ago, and just when I was stuck browsing for the guts of a looper earliertoday…I went back to your pd section and found this! Thank you so much for this🙂

  2. Great stuff! This very similar to what I’m working on with multiple tape recorders. But maybe I will make a digital version? )

  3. Excellent post, thanks! I’m trying to do something similar and I’m using your patch as a base for my idea. I was using SooperLooper but it has some problems with Rate, Pitch and Stretch controls, so I hope I can implement those functions in PD.

  4. Vonbee says:

    Hello Pierre,

    Merci beaucoup pour ce patch qui fonctionne à merveille !
    J’ai besoin d’avoir un contrôle du Pitch sur la bande de sorte à pouvoir lire et enregistrer -n tons au dessus /en dessous. Or je ne vois pas comment faire car on ne peut pas contrôler la fréquence d’écriture de l’objet Tabwrite (contrairement à Tabread) ! Auriez-une idée à ce sujet ?

    • Salut,

      Je ne vais pas avoir le temps de te donner une réponse complète malheureusement.
      Ce qu’il faut modifier c’est autour de l’objet [tabplay~], au niveau de la lecture. Le remplacer par un [tabread4~] et faire les modifs à partir de là. Ce n’est pas au niveau de l’enregistrement que ça se passera.
      Avec le patch actuel ce qui est lu est directement réenregistré ([s main_out~] parce que la durée de lecture est égale à la longueur totale de la boucle. Il faudra modifier ça si tu changes le pitch (et donc la vitesse de lecture).

      • Vonbee says:

        Merci Pierre, tes pistes sont déjà un bon début de réponse pour moi.

        En fait, j’avais déjà remplacé l’objet [tabplay~] par l’objet [tabread4~] et la vitesse de lecture fonctionne bien. Mais mon problème est justement lié à l’écriture qui continue en l’état d’enregistrer le son à la vitesse normale même quand la vitesse de lecture est réduite ou diminuée.
        Donc, je vais chercher du côté des modifications du temps de la boucle pour l’enregistrement en fonction de ma vitesse de lecture en cours.

        A+

      • Salut, tu peux essayer de n’augmenter ou diminuer la vitesse qu’avec des multiples de 2, et de ne redémarrer l’écriture ([s~main_out]) qu’une fois sur 2, sur 4 etc.

  5. Paul says:

    HI. This what I have been looking for. .Im very analogue based, and just getting into embedded stuff also. I wonder what AD/DA arrangements you use connected to the Raspberry Pi?. This is obviously to record the guitar, and play it back

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s