Dear ChucKists.
(particularly Dan who asked me for examples of LiSa usage a while back)
Below you'll find a example of how to make LiSa's loop points snap to the
next positive zero crossing in her buffer, provided the buffer was loaded
from a recorded file using SndBuf.
This has many uses, particularly to glitch-free loop a sample that's not
noisy enough to hide clicks and/or particularly bass heavy in situations
where the overall structure of the program loops at a different rate then
the sample loop length and crossfading would mean adding shreds..This is a
polite way of saying it's especially good for cheap & easy stuttering
kick-drums.
Mind that this will change the loop's length and thus pitch and/or timing,
it's much cleaner sound-wise though.
In some situations this may be cleaner or lead to cleaner code than the
methods in the examples/docs but it would be a bad idea to think this is the
best way to avoid clicks in all cases as it isn't. It's a interesting option
though and one I found to work well compared to it's complexity.
With lots of comments, I hope others will find this as usefull as I'm
finding it now.
Yours,
Kas.
==================================================
//Zero crossing detection and snapping for LiSa by Kassen
//Permision granted for redistribution, modification, etc.
//no waranties, no refunds, please mind your speakers.
//Remixing strongly encouraged.
SndBuf buf => LiSa l => dac;
//your sample goes here
//this patch is primarily meant for low drum beats or notes
//clicks aren't as objectionable for claps and the like
//may be impractical for lengthy soundscapes.....
buf.read("kick.wav");
int n, m;
float last;
int crossings;
2::second => l.duration;
//detect the number of positive zero crossings in the file
//we do this faster than realtime
//if you try this for long samples while other stuff is running
//there may be glitches as this likely maxes out the cpu
//due to not advancing time
for (0=> n; n
participants (1)
-
Kassen