modulated allpass filter

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Hello everybody. I experimented with simple classic reverb using combofilter and allpassfilter. Now I want to make a reverb using feedback delay network. I can’t figure out how to create a allpass filter with modulation.

This is what i have now. Sorry anti-bot does not allow to place the code :?
https://www.codepile.net/pile/kwRX48ZQ (https://www.codepile.net/pile/kwRX48ZQ)

Post

Hi Losman. The "most obvious suspect" for modulating these allpass filters made of longish delay lines is the same as modulating any delay line-- Gradual change of the delay line length over time.

A typical delay line might be a circular buffer with a head pointer which is writing samples and a tail pointer which is reading samples. The head pointer increments 1 for each sample tick of the system. When either pointer hits the buffer top it wraps back to the buffer bottom and keeps going. To gradually modulate the delay line length, the tail pointer would increment a little bigger than 1 for about half of the time, and the tail pointer would increment a little less than 1 for about half of the time, so that the overall "center delay" of this drifting tail location stays the same distance behind the buffer head, neither gaining and over-running the head, nor falling so far behind that the head laps the tail.

For sake of silly example, maybe the tail pointer first creeps ahead like, 0, 1.1, 2,2, 3,3, 4,4, 5.5 etc for awhile maybe for 1000 sample ticks and a tail pointer value of 1100, at which point the tail pointer has gradually crept 100 samples closer to the head pointer. Having gradually shortened the delay time by 100 samples over a duration of 1000 samples thruput. Then the wobble changes direction and the tail pointer starts starts lagging like, 1100, 1100.9, 1101.8, 1102.7, 1103.6, 1104.5, etc. The tail pointer gradually falling behind over the next period of 1000 samples until the delay length returns to the same length we began with at the start of the modulation cycle.

That amount of modulation in the example is way too fast of a wobble and too-extreme pitch modulation. Merely a concrete example to illustrate the idea. Practical modulations will likely be much slower.

Because the tail pointer needs to "read between the cracks" of the samples you need to interpolate the tail values. There are many interpolation methods of various complexity and advantages/disadvantages. For reverb delay line interpolation, linear interpolation may be good enough. Linear interpolation adds a little bit of distortion and it tends to slightly lowpass filter very high frequencies, but is computationally efficient and in a reverb you might be doing LOTS of linear interpolations on LOTS of delay lines. Something fancier might get too expensive. Or not. YMMV. Also, "realistic" reverbs tend to damp very high frequencies, so the slight low-pass-filtering of linear interpolation might not even be a noticeable disadvantage. Dunno.

I am not an expert but would suppose that if you modulate with a LFO, reasonable modulation rates might be in the range between 0.5 and 2.0 Hz. Some folks have modulated delay lines with very heavy lowpassed random noise and maybe thats great but the times I tried LF random noise it didn't please my ear.

Recently was hobby-programming modulated delay lines on a 24 tap delay "kinda like Ursa Major Space Station" with a dedicated LFO for each tap. I set it up so that each LFO runs at constantly changing random rate between 0.5 and 2.0 Hz. My ear doesn't like repeating patterns. 24 constantly-rate-changing LFO's maybe you would hear a pattern about as often as all the planets AND all the moons align. :)

I think if the LFO rate is always "too fast" then we would hear too much vibrato/chorus in the verb. However if the LFO rate is always "too slow" maybe bad resonances wouldn't get squelched fast enough. For example maybe if a particular allpass, under certain conditions, likes to ring pretty quickly after it is nudged. With a 0.5 Hz LFO, maybe we are giving that allpass more than a half-second to "do its mischief" before its LFO can cycle far enough to kill the ringing? Maybe lead to "intermittent ringing" popping up then squelching up and down the spectrum at rates slow enough for the ear to hear? Anyway that is why I tried random-frequency LFO's. The LFO always has the same peak-to-peak level so the modulation amount is predictable, but I keep changing the LFO rate on each new LFO cycle. My biggest issue with filtered noise modulation was that the modulation amount was not easily predictable.

LFO shape: Sin LFO shape is probably best. With this delay line length modulation, the pitch modulation is the derivative of the LFO shape. A Tri LFO gives Square pitch modulation, a two-pitch trill. As the Tri is constantly ascending, the delay line is constantly getting shorter and the tail plays a steady pitch "a little bit sharp". Then as the Tri is straight-line descending, the delay line is straight-line getting longer and the tail plays a steady pitch "a little bit flat".

Maybe that works great in reverbs, with the tiny amounts of pitch shift involved. It is just that if I want to add musical-sounding vibrato, then it isn't often I pick square-wave trill vibrato.

The derivative of sin is cos. So with Sin LFO delay-line-length modulation you get Cos shaped pitch modulation, which sounds the same as Sin shaped pitch mod except for the starting phase.

Note that with Sin LFO delay-line mod, the biggest pitch mod happens at the sin zero crossings. The smallest (zero) pitch mod happens at the positive and negative peaks when the wave changes direction. Bigger rate of change gives bigger pitch mod, and the biggest Sin rate of change is at the zero crossings. That is why a Sin delay line mod gives the Cos pitch mod-- the Pitch +/- Peaks are centered on the Sin zero-crossings and the Pitch zero-crossings are centered on the Sin +/- Peaks-- The same phase relationship that Cos has with Sin.

Post

Had a quick look (I'm on my phone, so can easily miss things) and I'm pretty sure there's a couple of errors in the allpass code. It should be something like:

Code: Select all

55: float temp = input - bufferedValue * coefficient; // in your example the coefficient is hard coded to 0.5

58: output = temp + bufferedValue * coefficient;
That's assuming you are aiming for a structure like:

Image

Then to modulate instead of a single bufferIndex you will need a readIndex and a writeIndex, so that you can continue to write to the buffer at regular sample intervals and also be able to read from modulated index positions. Additionally you may need to implement some kind of interpolation to read at fractional positions.

Post Reply

Return to “DSP and Plugin Development”