____: Re: [PD] On arrays.

padawan12 padawan12 at obiwannabe.co.uk
Thu Sep 28 14:26:28 CEST 2006


On Wed, 27 Sep 2006 23:14:54 +0100 (BST)
Tas Pas <tprotopgr at yahoo.gr> wrote:

> As "clicks" I mean what in the pd/doc/B09.loop.smooth.pd we try to avoid when
> the phase wraps around. 
> 
> I noticed in a wave file with a "click",  that we have a steep drop of the
> ampitude. The amplitude of each sample is near (in amplitude value) to the
> one before and next to it, but the sample that produces the click has an
> amplitude that is not near to the preceeding sample's amplitude value.

That's a pretty good definition of a click. It's a discontinuity in the signal.


> 
> Maybe that is what produces the clicks...
> 
> So new questions may rise (if I am correct in my speculations)...
> 
> 
>    Is there a "safe" amount of amplitude change in a sample comparably
>    to the amplitude of the previous and the next sample's amplitude, 
>    in order to avoid "clicks"?

>    Is there a way to prevent clicks when a wave loops in an arbitrary range?

It depends very much on the source signal you loop, some noisy sounds that
are already very full of buzz and clicks can be looped easily and the click
doesn't matter. Whether you hear the click depends on the size of the jump
compared to the dynamic range of the rest of the signal.
It will sound worse on pure tones. It sounds worse on low frequency
sounds or ones with a strong low fundamental. It can happen even when
the sound is apparently silent if you have a DC offset. The oldest trick is
to crossfade the end and start points, a la early samplers like the Fairlight,
Mirage, and Akai which introduced crossfade looping. You could work out some
magic number for the least audiable click sound using psychoacoustic metrics,
but from experience it's about 2 or 3 hundred in 65536 (for 16 bits) or about
0.25% fsd, anything above that you can usually hear. If you think about why it
happens it is obvious - the chances of the end of a loop finishing on the exact
value the loop starts with is small. For most musical applications you can just
cut the loop visually, start on a rising positive phase (crossing zero going up)
and end on the zero of a negative, rising cycle (so they wrap round nicely).
Just getting the zeros isn't enough, if you are out of phase it will still click
like a bastard. The perfect loop length then is an integer multiple of the period
of one cycle. In theory, once you've got that size you can move it about over the
sample with impunity. In practice, with real recorded sounds, that doesn't happen
but you can find sweet spots by hand where it does work. 
If you need exactly sized tables for a wavetable synth or
something then you will probably have to use timestretching too, because there
is probably no solution of two correct zeros that just happen to be a perfect
block size. What are you looping? Beats or musical tones, it makes a difference
to which technique is best. 





More information about the Pd-list mailing list