Spectral Delay Example (trying to add feedback)

geddonn's icon

Hi guys, I'm very new to this type of coding although am fairly proficient in Max/MSP.

I've been trying to add a feedback(per bin) control to the Spectral Delay example shipped with Gen.
I've tried messing about inside the Gen patcher with 'The Garden Of Earthly Delays' tutorial as my inspiration using [mix] and [history] objects but implementing feedback in this way in the frequency domain is causing me problems, (ie. this way it's feedback across all bins. also I get audio driver overloads due to not knowing what values to clip and fold between in the frequency domain - folding -1 1 seems to weaken the signal significantly).

Could anyone give me some tips on implementing this?
I think the Spectral Delay is a very interesting effect but is just a little bland to my ears without feedback.

t's icon

check out the paper "Spectral Delays with Frequency Domain Processing" by Kim Boyle. I'm not sure if it deals with feedback though...

Also check out the patch (its not mine)...

The patch is without the feedback but I guess that in the same way that it reads delay times for bins from buffer, it could also read feedback information...

3309.mainpatch.maxpat
Max Patch
Graham Wakefield's icon

A fortnight later he replies...

Max Patch
Copy patch and select New From Clipboard in Max.

Here's one way to do feedback. I added another parameter buffer for the feedback coefficients, like the delay and amplitude buffers. Inside the gen~ you can see I took the output of the amplitude delay, scaled it by this coefficient (per bin according to the frame index), and used a [delay 2048] to act as a kind of 'history' object in the pfft~ world. Because this is a feedback loop, there will be a minimum delay time of one FFT frame in the feedback loop. A bit more fancy patching could compensate for that perhaps. I've mixed this back in before the amplitude scaling ('pre-fader'), but it could be mixed in post-fader if preferred, perhaps with a separate feedback amplitude parameter.

Graham Wakefield's icon

Once again, I forgot about the sub-patcher. Try this:

3446.gen.spectraldelayfeedback.maxpat
Max Patch
geddonn's icon

Ooh, thank you so much, sounds fantastic.

Roman Thilenius's icon

another options is to simply have a feedback loop outside the fft. (i am aware of the
limits it has, but it is ok for most situations.)

Graham Wakefield's icon

More fun can be had by adding a little offset to the delay time in the feedback path, so that it feeds back into a different bin. Swooshy.

Alex Rodrigues's icon

3446.gen.spectraldelayfeedbackfilter.maxpat
Max Patch

I know this is a pretty old thread, but I think Graham forgot to implement the filter, so I did.

I also removed the polar conversion as it is unnecessary if we're performing the same operation on both parts of the complex signal.