Tips : Effect tamplate with A/B and On/Off switches

This little post aims at providing you with tips for writing effect patches for your guitar that are glitch-free (using an A/B switch) and that can be turned off when not in use. You can download the template at the end and adjust it to your needs.

By “turned off” i mean that the audio computation can be turned off, thus freeing resources in your computer. This can reduce the risk of glitches due to x-runs in JACK, and allow CPU-intensive effects to be used (like fft-based effects for instance).

To turn off audio computation, we use the [switch~] object that comes with the standard Pure Data package (“pd-vanilla”). Sending it a “1” turns the audio on, and a “0” turns it off. It only affects the audio in the subpatch or abstraction which contains this object, which makes it possible to turn off an effect individually without turning off the rest of the main multi-effect patch.

While turning on and off a subpatch or an abstraction, it is also necessary to route the audio signal appropriately to the wet or the dry paths, much like a hardware A/B switch. We use the [line~] object to aboid glitches when switching from one path to the other.

Here’s what the template looks like in a patch.

Tamplate for guitar effect made with Pure Data

And here’s what’s inside. You can see how the A/B switch works, and also how the GUI is connected to the inside of the template.

A/B switch and GUI for guitare effect template made with Pure Data

And finally, the subpatch in which the actual effect should be. Notice the [switch~] object to turn audio computation on and off within the subpatch.

Subpatch inside guitar effect template made with Pure Data

Please note that the actual template that you should use for your own effects is the object with the GUI in the first picture. In can be inserted into any effects chain. The template is a subpatch (a [pd something] object). I suggest saving this as an abstraction for a particular effect if you plan on using your effect in different patches. Please also note that your actual effect patch should be put in the “core” subpatch of the template, bewteen the [inlet~] and the [outlet~] (the template does not alter the sound as such, it is not an effect).

You can download the template here.

This entry was posted in Tips for writing patches and tagged , , , , , , . Bookmark the permalink.

2 Responses to Tips : Effect tamplate with A/B and On/Off switches

  1. Pingback: Tips for writing efficient patches in Pd | Guitar Extended

  2. Chris Meng says:

    Your site is awesome and thanks so much for the help!

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