difference between analog, digital and tape delay algorithms

DSP, Plug-in and Host development discussion.
runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Thu Oct 01, 2009 7:46 pm

OK, here's what I know as a non-programmer who happens to be working with one to design a delay:

I've looked at the code of SynthEdit's delay module.

It is identical to that in the VST SDK.

I know that the interpolation of the delay time when you modulate it in SE's "Delay 2" module is very different, and makes a semi-tape delay sort of effect that I, of course, greatly love.

Where can I find an example of something like that to ponder and use to elaborate further?

I, of course, have pored over DSPdimension, the VST source code archive and many other sources without finding something that makes sense to my non-coder mind.

If someone can explain it to me, though, I'd greatly appreciate it.

It's pretty amazing to be making progress on an effect which, to my mind, is a solution to something some of us have wanted to be able to do with fx-based sound design for decades 8)

eigentone
KVRist
277 posts since 3 Apr, 2007

Post Thu Oct 01, 2009 8:46 pm

Hey Runagate,

To start a tape delay, you'll need 2 primary ingredients:
1) Delay
2) Tape simulation

I would just develop these 2 effects independently, and then combine them.

So the delay would need controls for regeneration, mix, time, etc and some kind of insert effect interface when writing to (or reading from) the delay buffer.

The tape emulation, well... this can be tricky if you want to make a *good* model. There are probably a few characteristics you want to begin with, such as reduction in frequency response and dynamic range, maybe some saturation at higher levels, add noise and crosstalk from the drum track, and so on. Doing this (well) will require much more time than the delay bit, doing it on par with other simple tape delays should not be painful (they prolly use lpf+hpf+saturation). You probably won't need or want (for performance reasons) a good model - a good model would likely add a few stages of convolution to that, and better stauration. The cool thing is that it is one of the few effects where latency is avoidable (i.e. you'll always have 10ms of lookahead for the saturator, if you set the minimum delay to 10ms).

So I would start by making the delay with 'insert' capabilities, then make a tape sim that sounded good to you. After that, you'll just need to refine it and add some subtle touches, like code for tape speed instabilities.

J

runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Thu Oct 01, 2009 10:25 pm

eigentone wrote: The tape emulation, well... this can be tricky if you want to make a *good* model. There are probably a few characteristics you want to begin with, such as reduction in frequency response and dynamic range, maybe some saturation at higher levels, add noise and crosstalk ...

So I would start by making the delay with 'insert' capabilities, then make a tape sim that sounded good to you. After that, you'll just need to refine it and add some subtle touches, like code for tape speed instabilities.

J
I appreciate your answer but, oddly, those parts I already understand (in a DSP, not code-specific) way.

Dynamic addition of noise, magnetic hysteresis (from reading about Ferrox by Jeroen Baerbart, back-tracking from the definition of hysteresis just out of curiosity while writing about it on the ooTray.com blog), dynamic saturation emulation via polynomial functions in a waveshaper resynthesis, etc.

What I don't get is what exactly determines how the delay time's being modulated results in the different "interpolation artifacts" I hear. My SynthEdit plug-ins almost all rely on the Delay 2 SE module going "whacky" when modulated, as do Doveraudio's and Jack Dark's Darkware FSY fx, just to name a couple.

Whereas modulating the delay time of the original Delay SynthEdit module (1? dunno, the original and the one that's the same as the example in the VST SDK, as well as the example in VST.NET, which is what we're using, for that matter) just... changes the delay time for input that comes after the change... there's no particular change in the pitch or speed of the buffered audio.

Obviously, the various "dub delays" that're out there rely on the type of non-delay post-processing that you described to change the tone of the echoes over time, but when you change the delay time they react just as when you manually grab the tape on a hardware tape delay and move the tape around at a new speed, the pitch and speed of the echoes changes.

So I'm wondering what types of interpolation algorithms give these different behaviors. I have called it "digital" when modulating the delay time results in no artifacts, "tape" when the entire buffer is obviously being scrubbed, and "analog" when it... well, get's kinda wonky but doesn't exactly resemble the "scrubbing" of the aforementioned hardware tape delay.

Does that make sense?

From a DSP semi-literate and programming-illiterate perspective, what I imagine is differing buffer lengths being stored... but what would govern the playback speed... I can almost intuit how to code that (or at least explain it to my programmer partner) but not the in-between states, the "analog" one...

I'm just wondering if there's some standard algorithms or code that everyone picks amongst that I've somehow not run into yet.

I even get how grain clouds, buffer override stuttering effects, and all that work. I'm just missing something...

Obviously, I'd like to be able to pick amongst the "flavors" since each is useful in different situations.

Perhaps buffer read-through speed and various slew rates have something to do with it? Just typing it out like this helps me model it...

Hmm, I'd love the delay to granulate when modulated, lol. Is there a VST like that? But I digress.

I'm sure it's one of those things where I'll slap my head and say "doh!" once I hear the explanation. Or perhaps it's a case-by-case trade secret? That's certainly a possibility I'm willing to accept.

I know one thing: if I get this thing to work (the innovations have little to do with interpolation algorithms, sadly... I wish I were creating variations on that!) I will have to make the damned biggest signal chain diagram to help others create variations on this monster in the future.

mdsp
KVRian
626 posts since 29 Jul, 2003 from Paris - France

Post Fri Oct 02, 2009 12:32 am

a Tape or Bucket Brigade Delay is better emulated using a fixed delayline with a variable sampling-rate (but implementation is less straight-forward)

classic digital delays typically modulate the length of the delay-line while, Tape and BBD modulate the speed to change the delay.

It's similar to a guitar where to change pitch you can either change the length of the string or change its tension.

the big advantage with modulating speed instead of position is that the delay changes are naturally smoothed/integrated/delayed by the delayline itself and that makes a huge difference sound-wise.

User avatar
justin3am
KVRAF
10984 posts since 7 May, 2006 from Southern California

Post Fri Oct 02, 2009 12:39 am

runagate wrote: Hmm, I'd love the delay to granulate when modulated, lol. Is there a VST like that? But I digress.


FabFilter's Timeless in stretch mode. Have you played with the grain cloud delay in reaktor yet?

eigentone
KVRist
277 posts since 3 Apr, 2007

Post Fri Oct 02, 2009 12:50 am

Hey runagate,

Ok, just put what you know about the physical objects used for the effect into programming objects:
1) Tape loop = fixed size buffer (this buffer's size should be at least your sample rate, perhaps you will want to oversample because there is a fair amount of interpolation to do)
2) reel to reel with varispeed = a parameterized object which determines the rate at which to scan across elements in the buffer.

you write at a fixed rate at all times, but you read at variable, modulated and smoothed rates. When you read, you will want to read using a decent interpolator to minimize aliasing during animations. You still will introduce aliasing, but you can cheaply minimize it by using a good interpolator.

The easiest way to accomplish this is to just read and write across the whole table all the time. Table size should be large enough to write n seconds to, plus maximum render call + some room for the interpolator. First write to the delay buffer then read from the buffer to output, modulating the traversal rate as you write to output. If it helps, this is like a phase accumulator for reading from a wavetable (which is also read at variable rates). Phase increment range will likely be 50% to 200% actual rate at extreme settings (i.e. parameter gestures), and about 98% to 102% when 'stable' - where 100% equals 1 sample read per sample written. This will give the pitch shifting effect you seek when reading. The input is written at the same rate and continuously across the entire buffer, but the difference between read and write position varies to get specific delay times. In really simple terms, if you understand a standard digital delay algorithm, and a single cycle wavetable which can play any pitch +/- one octave, you should come close by combining the conceptual components.

J

runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Fri Oct 02, 2009 1:14 am

eigentone wrote:If it helps, this is like a phase accumulator for reading from a wavetable (which is also read at variable rates). Phase increment range will likely be 50% to 200% actual rate at extreme settings (i.e. parameter gestures), and about 98% to 102% when 'stable' - where 100% equals 1 sample read per sample written...

...and a single cycle wavetable which can play any pitch +/- one octave, you should come close by combining the conceptual components.
Part 1: Oddly enough, I was starting to understand that last night while researching something unrelated... ok, I think I follow that.

Part 2: That's the "it's painfully obvious once I see it written down" part I was waiting for ;)

I think that there's a nice spectrum between reading from a long buffer, but only for the necessary parts, and at the speed that'll give the correct delay time (something we've almost got the coded correctly now, anyways) and one which doesn't exhibit this desired side-effect which we can now explore.

It's 4 am here and this is the kind of help I need when the only time two friends can get together is once everyone in either household is gone or asleep 8) Thanks, eigentone. I really appreciate it.

duncanparsons
KVRAF
8379 posts since 11 Apr, 2003 from now on the flat

Post Fri Oct 02, 2009 1:26 am

mdsp wrote:a Tape or Bucket Brigade Delay is better emulated using a fixed delayline with a variable sampling-rate (but implementation is less straight-forward)

classic digital delays typically modulate the length of the delay-line while, Tape and BBD modulate the speed to change the delay.

It's similar to a guitar where to change pitch you can either change the length of the string or change its tension.

the big advantage with modulating speed instead of position is that the delay changes are naturally smoothed/integrated/delayed by the delayline itself and that makes a huge difference sound-wise.
That's a challenging proposition, I'd not thought of that before. I guess one could perform the sample rate change at either input or output for slightly different effects - or am I looking at it the wrong way?
Image

eigentone
KVRist
277 posts since 3 Apr, 2007

Post Fri Oct 02, 2009 2:32 am

runagate wrote:
eigentone wrote:If it helps, this is like a phase accumulator for reading from a wavetable (which is also read at variable rates). Phase increment range will likely be 50% to 200% actual rate at extreme settings (i.e. parameter gestures), and about 98% to 102% when 'stable' - where 100% equals 1 sample read per sample written...

...and a single cycle wavetable which can play any pitch +/- one octave, you should come close by combining the conceptual components.
Part 1: Oddly enough, I was starting to understand that last night while researching something unrelated... ok, I think I follow that.

Part 2: That's the "it's painfully obvious once I see it written down" part I was waiting for ;)

I think that there's a nice spectrum between reading from a long buffer, but only for the necessary parts, and at the speed that'll give the correct delay time (something we've almost got the coded correctly now, anyways) and one which doesn't exhibit this desired side-effect which we can now explore.

It's 4 am here and this is the kind of help I need when the only time two friends can get together is once everyone in either household is gone or asleep 8) Thanks, eigentone. I really appreciate it.
You're welcome. It's funny how simple problems become complex problems when you are in the process of developing them - it happens to everybody as far as I am concerned. When this happens to me, I often start with a class interface composed of the prerequisites and work from there... by the time I get to implementation of that missing link... it is usually as obvious as reading the answer. Another 'aha way out' is to describe the operation as you would to a 5 year old. If your current line of thought still does not work in practice, just try writing a delay which reads at half speed until the delay max is reached, then write to output at 2x speed. until delay is zero, then figure out a way to control that read rate, you'll need a floating point accumulator, but you can worry about interpolation at a later stage. You could also post a code snippet and point out where you are stuck... I drafted pseudocode for this topic, but it became time consuming and I scrapped it :)

Best,

J

User avatar
HanafiH
KVRian
1294 posts since 6 Mar, 2001 from London, UK

Post Fri Oct 02, 2009 2:41 am

Analog:

Image
Ge ger ge ger ge Granville.

Digital:
Image
Paranominominominonia

runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Fri Oct 02, 2009 3:06 am

eigentone wrote:You could also post a code snippet and point out where you are stuck... I drafted pseudocode for this topic, but it became time consuming and I scrapped it :)

Best,

J
Can't cuz I'm the designer, not the programmer.

But there's no problem in the code we've used thus far, it's a non-interpolating delay. Modulating the time parameter doesn't do anything to the buffer, lest you count the feedback cycling through at a faster or slower rate (mind you, I'm a musician obsessed with Fx and mostly know what I'm talking about here, ok?)

I'm looking to implement additional flavors of what happens when you modulate the delay time. I think what I conveyed to my partner, Armz, makes sense to him now. He, despite being quite the professional programmer and freaky math genius, isn't familiar with DSP nor effects design, terminology, or musical useage ;)

So, of course it's lots of fun melding our respective worlds, with a half-unknown island to be stranded on.

At least I can guarantee one thing: my design is Byzantine ;)

I understand buffer override effects, so I can easily imagine how to describe a "tape delay" flavor in his terms now. For that matter I have source code to several plug-ins I'll peek at and see if I can understand how to dream up some new variations thereon.

Really, though, this isn't a critical part of the VST. My love of choosing what kind of artifacts that modulating the delay time causes is personal quirks. I desire it enough to learn wtf I'm talking about, though.

One question: since the Host can change tempo (an effect I love using on tape delay VSTs) how often should the plug-in querry the host? Or does the host just send it along at whatever the ppq/tempo/sample rate equation makes the update speed to be? Man, too tired to make good sentences now ;)

runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Fri Oct 02, 2009 3:08 am

duncanparsons wrote:
mdsp wrote:a Tape or Bucket Brigade Delay is better emulated using a fixed delayline with a variable sampling-rate (but implementation is less straight-forward)

classic digital delays typically modulate the length of the delay-line while, Tape and BBD modulate the speed to change the delay.

It's similar to a guitar where to change pitch you can either change the length of the string or change its tension.

the big advantage with modulating speed instead of position is that the delay changes are naturally smoothed/integrated/delayed by the delayline itself and that makes a huge difference sound-wise.
That's a challenging proposition, I'd not thought of that before. I guess one could perform the sample rate change at either input or output for slightly different effects - or am I looking at it the wrong way?
I think you're right. I've been drawing a lot of signal diagrams in 6 colors, anyone got a 7th color pen handy?

duncanparsons
KVRAF
8379 posts since 11 Apr, 2003 from now on the flat

Post Fri Oct 02, 2009 3:22 am

HanafiH wrote:Analog:

Image
Ge ger ge ger ge Granville.

Digital:
Image
Paranominominominonia
Excellent explanation :)

One probably has to be of both of a certain vintage and particular culture to fully appreciate the impact of that distinction!
Image

runagate
KVRAF
10106 posts since 17 Sep, 2004 from Austin, TX

Post Fri Oct 02, 2009 3:24 am

Well, DSP, if we make something that has it "both ways" like you say, I'll post the code, I promise ;)

I wish you were in the room :P I'd love to fill your lovely mind with my design ideas.

duncanparsons
KVRAF
8379 posts since 11 Apr, 2003 from now on the flat

Post Fri Oct 02, 2009 6:48 am

well, I'm not far away. I'm always open to stuff.. Of course, can make no promises, but still have open ears :)
Image

Return to “DSP and Plug-in Development”