the crossfade affects both playback and recording.
yes, the start/end of the loop is the beginning of the crossfade.
under the hood, there are two sub-heads.
description assuming rate > 0:
let’s call the position of the sub-heads P and Q,
the start and loop points are A and B, the loop length is B-A = l, and the fade time is f.
let’s call the wall-clock time t, and say t=0 when the loop first starts playing/recording.
let’s also say that full overdub is enabled (rec_level=1.)
so on lua side you have done something like
sc.loop_start(1, a)
sc.loop_end(1, b)
sc.loop(1, 1)
sc.fade_time(1, f)
sc.rec(1, 1)
sc.rec_level(1, 1)
sc.pre_level(1, 1)
sc.position(1, a)
sc.enable(1, 1)
on the first pass through the loop, you will hear subhead 1 fading up between t=0 and t=f as P advances from A to A+f.
as soon as P=B, subhead 1 begins fading out and subhead 2 begins fading in.
as subhead 1 fades out, it is still recording, adding incoming signal to the buffer in [B, B+f].
so on the second pass through the loop, from t=l to t=l+f you should hear a combination three things, with P = [B, B+f] and Q = [A, A+f]
-
- original contents of the buffer past the loop endpoint, from B to B+f, being played by subhead 1, fading out
-
- original buffer contents at start of the loop, from A to A+f, played by subhead 2, fading in.
-
- new signal from the time interval t=[0,f], which has been mixed with the original in the first pass, also fading in.
then from A+f to B its a straight combination of the original contents and the signal from the first pass.
so, in a nutshell:
-
the xfade is only audible at the loop start. this is just simpler to implement than having it centered on the loop start, and is easy to reason about even if it’s not always the most convenient thing for the application.
-
so, for something like drum loops you may want to actually place the loop start before the first transient.
-
you also want to be careful to have some post-roll in any samples you load or buffer regions that you copy if you want the fade time to have a useful effect.