Spectral Delay effect for guitar with Pure Data

In this post I’ll show you how to unleash the power of DSP (digital signal processing) to make your guitar sound like never before. The spectral delay is one of my very favorite effects, and I doubt that it can be achieved with any analog guitar pedal. It uses FFT analysis (fast Fourier transform) to create hundreds of sparks or stars that fall like raindrops or broken crystal. I just think it sounds beautiful.

The patch in this post was created by Frank Barnecht and posted on his website a few years ago. I use it here with his kind permission.The original package can be downloaded here (you can learn a lot more about FFT analysis by reading his post). EDIT : Frank Barnecht’s patch is based on a tutorial by Johannes Kreidler. He wrote a very good and comprehensive Pd tutorial available here.

So what is a spectral delay? “Spectral” refers to the spectrum of a sound, that is (roughly) the distribution of the frequencies it contains over the range of frequencies that the human ear can percieve. Every sound is made of (or can be reproduced by) many sine waves with different frequencies. A note played on a piano for instance is actually made of many sine waves added together : the fundamental and the partials (or harmonics).

Fast Fourier Transform analysis, named after french mathematician Joseph Fourier, is a method to find these individual sine waves in any sound. It can be used to find the spectrum of a sound. In Pd, FFT analysis outputs a lot of numbers describing the sound that’s being analysed. These numbers can then be used to perform resynthesis using the inverse Fourier Tranform. What’s interesting for us is that some processing can be done on the numbers between analysis and resynthesis.

In the spectral delay, we use FFT to cut the sound into very thin frequency bands. A different delay is then applied to each of these bands before resynthesis. If the length of the delay lines is very different from one frequency band to another, the result is that the original sound is scattered and you can hear all the partials (harmonics) ringing at different times.

Here’s a screenshot of the patch (though all the interesting stuff is in the abstration).

Spectral Delay effect for guitar made with Pure Data

I encourage you to play with the different controls in the patch. You can obviously adjust the mix between dry and wet signal, but it will be much more interesting to change the value in the “del-sin” and “fb-sin” number boxes. These automatically create a sine wave of adjustable wavelength in the Delay and Feedback tables that are used between FFT analysis and resynthesis. You can also use the vertical sliders to set the entire table to a constant. The first horizontal slider between the Delay and the Feedback tables makes the delay deeper. All these controls are from Frank Barnecht’s original patch and I think they’re wonderful to help you understand what a spectral delay is. I have just added two sliders at the bottom that can be used to cut the higher frequencies (which sometimes sound too digital to me).

  • Download my (slightly modified) version of Frank’s patch here.
  • I suggest you listen to this sample first!

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

10 Responses to Spectral Delay effect for guitar with Pure Data

  1. nathan says:

    The links to the patches are broken. Any way to fix?

    • Hi Nathan, the link to my patch at the very bottom works fine. The link to the original patch on Frank Barnecht’s website is currently broken due to maintainance on his site.

  2. Nathan Walker says:

    This is amazing.

  3. CMcBride says:

    What is the coding program you are using? and Can it be converted to arduino? Thanks

  4. Ian McCowan says:

    Unfortunately, this patch spits out the following error:
    error: audio I/O stuck… closing audio
    and totally borks my Raspberry Pi’s audio (subsequently no other patches work either, instead spitting out
    snd_pcm_hw_params (input): Input/output error
    snd_pcm_hw_params (output): Input/output error
    output snd_pcm_delay failed: Input/output error
    and repeating the last message indefinitely)
    until I restart.

    Have you seen any of this? Do you have any idea what might be causing any of it?

    • Ian McCowan says:

      It occurs to me that you never mentioned that you use this patch on your Pi. On further reflection it seems very likely that it’s actually just way too complicated for the Pi to do in realtime!

      • Right, i never tried this on the Pi. It could work though, with an adequate buffersize (you can change it in Pd’s audio settings). It should work at around 16 ms, with a sample rate of 44100 Hz, and without GUI (though I can’t guarantee anything).

    • The spectral delay uses fft, which is pretty expensive. You could try increasing the buffer size in Pd (to increase the latency, thus giving it more time to do the computation). It could also be a problem with your soundcard (unless it’s working fine with other patches).

  5. Pingback: Guitar FXBOX – Part 1, the software | Music Electronics

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s