Varispeed Overdubbing in Looper - Delay-line approach to rate > 1
Hi all,
Another newbie question. I appreciate the support.
Based a suggestion from Graham W., I am trying to apply his delay-line approach to overdubbing at rates > 1 in a varispeed looper I am building. I am adopting this approach from the looper example in Jeff K's/Gregory T's tutorials seen here: https://technophony.com/building-live-loopers-in-max/chapter-4-varispeed-overdubbing-looper-gen/
I have to say that the conceptual jump from the previous patch to this patch is quite a challenge for me.
In any case, my question is regarding the operation to "fill in skipped samples" when overdubbing at sample counter rates > 1. Graham's example is the following:
for (i=0; i<min(32, abs(t)); i+=1) {
// get the corresponding sound from our past input:
s = indelay.read((abs(t)-i)/aspd);
// write it to tape at the writer position
// using crossfading with existing data
poke(tape, s*xb, wb, 0, xa, boundmode="wrap");
// move the writer on one sample in the desired direction
wb += sign(t);
}t = how many samples are skipped, i.e., how many samples we need to fill in (if I am interpreting the other code correctly), and
aspd = (basically) the rate of playback
xb/xa = a crossfade on the input/overdub
I have a couple of questions:
I don't really follow the math in the delay read() function. Why divide by the speed?
how does this account for fractional sample indices, such as when the playback rate is a non-integer (e.g., 1.75)?
I'm having a lot of trouble wrapping my head around how the delay read function is working. For delay.read(x) - are you fetching the data at sample x in the delay buffer? For the code example above, wouldn't the value for read() need to be relative to where we are "in time" i.e., fetch the data from 3 samples ago?
Thanks in advance for helping me wrap my head around this stuff!