|
|
|
|
@ -7,8 +7,8 @@ c = Buffer.new(s);
|
|
|
|
|
// with basic params
|
|
|
|
|
Routine{
|
|
|
|
|
var startTime, goal, startThresh, prevThresh, curThresh, curVal, prevVal, iters, maxIters, dVal, dThresh;
|
|
|
|
|
startTime = Main.elapsedTime;
|
|
|
|
|
prevThresh = 0.1; //initial threshold
|
|
|
|
|
startTime = Main.elapsedTime;
|
|
|
|
|
prevThresh = 0.1; //initial threshold (between 0.00001 and 0.99999
|
|
|
|
|
goal = 10; //number of slices desired
|
|
|
|
|
maxIters = 100; //max number of iterations acceptable
|
|
|
|
|
|
|
|
|
|
@ -17,9 +17,9 @@ Routine{
|
|
|
|
|
s.sync;
|
|
|
|
|
//makes a second iteration
|
|
|
|
|
if ( (prevVal < goal), {
|
|
|
|
|
curThresh = prevThresh * 0.5;
|
|
|
|
|
curThresh = (prevThresh * 0.5).max(0.000001);
|
|
|
|
|
}, {
|
|
|
|
|
curThresh = prevThresh * 2;
|
|
|
|
|
curThresh = (prevThresh * 2).min(0.999999);
|
|
|
|
|
});
|
|
|
|
|
FluidBufNoveltySlice.process(s,b, indices: c, threshold:curThresh,action:{|x|curVal = x.numFrames});
|
|
|
|
|
s.sync;
|
|
|
|
|
@ -38,10 +38,10 @@ Routine{
|
|
|
|
|
|
|
|
|
|
if ( (dVal == 0), {
|
|
|
|
|
//if we have not change results between the last 2 passes, make the variation of threshold bigger
|
|
|
|
|
curThresh = dThresh + curThresh;
|
|
|
|
|
curThresh = (dThresh + curThresh).min(0.999999).max(0.000001);
|
|
|
|
|
},{
|
|
|
|
|
//if we have
|
|
|
|
|
curThresh = ((dThresh / dVal) * (goal - curVal)) + curThresh;
|
|
|
|
|
curThresh = (((dThresh / dVal) * (goal - curVal)) + curThresh).min(0.999999).max(0.000001);
|
|
|
|
|
});
|
|
|
|
|
FluidBufNoveltySlice.process(s,b, indices: c, threshold:curThresh,action:{|x|curVal = x.numFrames});
|
|
|
|
|
s.sync;
|
|
|
|
|
@ -58,4 +58,4 @@ Routine{
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}.play
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|