[chuck-users] delay times of STK delays seem to be 1 sample off?

Kassen signal.automatique at gmail.com
Fri Feb 29 15:10:15 EST 2008

Hi, Volker!

I'm not sure if this is your issue here but some theory;

ChucK uses a "pull through" model to calculate samples. So; every time the
DAC wants to output a sample the DAC asks (pulls) all Ugens connected to it
to report a value and those in turn ask all their inputs for one before
returning it (recursively). This works very well and guarantees a proper
calculation order of samples (compare that to MAX which uses a left to right
evaluation and PD which calculates modules in the order they are placed, I

All is well until we use feedback. If the DAC depends on a delay and that
delay in turn depends on itself we would get stuck so there we stop and the
sample used there is actually the *last* sample the delay calculated. This
last sample is called the "Z-1" (two samples ago would be "Z-2", etc).

So; all feedback loops get a sample added to their length, which can and
will affect tuning. Of course the higher the pitch the larger a samp as a
fraction of the pitch will be and so the more detuned it will be.
Fortunately this can be compensated for by subtracting a samp from the set
delay time.

Again, not sure if this is your issue but I'm a bit short on time at the
moment so I didn't run your code, it looks like it though. At least a little
theory can't hurt. It's a well known issue in systems like ours, but at
least thanks to having dur as a data type have plenty of tools to deal with
it and it's much, much better then the kind of thing you would get if you
tried the same in a system using block processing.

Hope that helps,


On 29/02/2008, volker böhm <vboehm at gmx.ch> wrote:
> hi,
> i was running some simple tests to hear the difference between
> allpass vs linear interpolating delay lines when i noticed that there
> is obviously a little bug in how the delay time is calculated in the
> delay UGens from STK.
> the following example feeds an impulse into a DelayA with high
> feedback and compares the tuning to a TriOsc.
> can't i trust my ears or is the tuning only correct if i add 1 to
> deltime before calculating the frequency for TriOsc?
> thanks,
> volker.
> Impulse imp => Gain out => dac;
> out => DelayA delay => out;
> TriOsc tri => dac;                              // test oscillator
> 44100.0 => float sr;                    // sampling rate
> // delay time in samples
> 150.5 => float deltime;
> deltime::samp => delay.delay;
> // calc tri freq from delay time
> // have to add 1 to deltime to get correct tuning
> sr / (deltime) => tri.freq;
> // set feedback level
> 0.999 => delay.gain;
> 0.3 => tri.gain;
> while(true) {
>         1 => imp.next;
>         6::second => now;
> }
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080229/7bc65648/attachment.htm 

More information about the chuck-users mailing list