Page 1 of 1

loop clicks

Posted: Sun Jan 25, 2009 2:11 pm
by piv
Hi Frank, hi All,
I'm trying to make a Loop Effect, but there is a problem with "loop clicks". Does anybody know how to remove them? I will appreciate any help.

Posted: Sun Jan 25, 2009 4:00 pm
by frank
Well, need a bit more info. Can you post the code so we can see what you are doing?

Posted: Tue Feb 03, 2009 12:28 pm
by piv
Hallo Frank,
here is a part of the code.

delay mem 4096

ldax POT2
sof 1,-1/128
skp NEG,LOOP

ldax ADCL
wra delay,0
skp ZRO,NEXT

LOOP:
rda delay#,0.99
wra delay,0

NEXT:
rda delay#,1
wrax DACL,1
wrax DACR,0

I would like to get a continuous sounding fragment,
but at the end and the beginning there are some clicks (loop clicks).
Is there a way to eliminate these clicks?
Maybe 2 parallel delay lines with time shift will solve the problem?
Thank you in advance!

Posted: Tue Feb 03, 2009 5:12 pm
by frank
OK, the click is from suddenly stopping the recording and just doing a playback. The click will cycle through the delay loop so what you will want to do is when you go from recording to play, fade out recording over a short time period and mix it with the loop output. Sort of like (sorry, can't write this in FV-1 code and try it at the moment):

if (recording) {
delay_in = ADCL
coef = 1.0
}

if (playback) {
temp = coef * ADCL
temp = temp + (1-coef)*delay_out
delay_in = 0.99 * temp
coef = 0.9 * coef
}

DACL = delay_out

Basically, when we go from record to playback, we keep recording for a short period, mixing the input with the output of the delay as coef decays from 1.0 to 0

Posted: Wed Feb 04, 2009 4:25 pm
by piv
Thanks for your help! It seems to work fine. But I have one more idea and question... Is it possible to detect and write into the memory 1 signal period? I think this should completely remove these clicks.

Posted: Wed Feb 04, 2009 5:14 pm
by frank
In theory it is but there is no built in method to detect a single period of a signal, you would need to detect it in your code by watching for things like zero crossings or peaks.

And, keep in mind, that if the signal is not an integer divisor of the sample rate then you will still have a discontinuity in the waveform. I.e. if sample rate is 32000Hz and signal is 1000Hz that is ok as there are exactly 32 samples/period but if signal is 900Hz that is 35.5 samples/period so you have to use 35 or 36 to hold the signal. In either case there is a discontinuity. Also, you will need to adjust the length of the delay to hold exactly one period of the signal.