Thank you. I understand that without the crossfade one gets clicks and that even a small fade_time makes a smooth transition. That’s great. I think my problem was one of an expectation / miscomprehension which you explain is not possible.
For what it’s worth this is the code I was using to test it. I had hoped I could layer successive sections of different pitches using fade_time as an envelope. And hear both sections together, in harmony. But one runs into the edge case you point out.
--crossfade ?
--a new start point every 2 seconds
--with these values
fadeTime = 2
length = 4
--you don't hear 2 seconds of both sections together at their respective pitches
function init()
--file = _path.code .. "nc02-rs/lib/big_bowl_hit_2_G.aif"
--soundfile is here https://www.dropbox.com/s/idwey5tx2wpj5vp/big_bowl_hit_2_G.aif?dl=0
softcut.buffer_read_mono(file, 0, 0, -1, 1, 1)
softcut.enable(1, 1)
softcut.buffer(1, 1)
softcut.loop(1, 0)
softcut.loop_start(1, 0)
softcut.loop_end(1, 3)
softcut.position(1,1)
softcut.rate(1, 1.0)
softcut.level(1, 1.0)
softcut.play(1, 1)
softcut.fade_time(1,2)
clock.run(xfade)
end
function xfade()
while true do
for i = 1,4 do
softcut.position(1,i)
softcut.loop_start(1,i)
softcut.loop_end(1,i + length)
softcut.rate(1,i*0.33 + 1)
softcut.fade_time(1,fadeTime)
--new start point every 2 seconds
clock.sleep(2)
end
end
end
function enc(n,d)
if n == 2 then
fadeTime = util.clamp(fadeTime + d/10, 0.0, 10)
else if n ==3 then
length = util.clamp(length + d/10, 0.1, 6)
end
end
print('fade time', fadeTime, 'length ', length)
end