Setting UGens to control wrapping/folding?

I’ve stumbled across this code from a lesson:

LeakDC.ar(DemandEnvGen.ar(
Dseq([min, min.neg, [max.neg, max]],inf),
Dbrown(sd, sd*100,
).wrap(SinOsc.ar(0.01))) * 0.3;

I don’t understand what’s happening here. I’ve been experimenting myself with this technique, using other oscillators and even noises to control wrap, fold, and wrap2 and fold2 too, got some crazy sounds, but I don’t really understand what’s going on.

wrap takes two arguments (lo and hi), so what is the SinOsc really doing here? setting the low level only while leaving the high at 1.0? setting both boundaries dynamically? same with fold.

I tried w/ wrap2 and fold2 and got sound too, though different, and I can’t really explain why even looking at plot graphs (kind of a newbie, sry).

can anyone explain?

thanks!

Yes, the hi argument will stay at it’s default of 1.0 if you don’t set it.
But wrap2 and fold2 only have 1 argument which is used for both min and max, above and below zero.
So mySig.wrap2(0.8) is equivalent to mySig.wrap(-0.8, 0.8).
That means that if you use SinOsc as the argument for wrap2/fold2, it will change both the min and max.

This shows both wrap and wrap2:

(
a = (-1.0, -0.99 .. 1.0);
b = a.wrap2(0.8);
c = a.wrap(-0.8, 0.8);
[a, b, c].plot;
)

I hope that helps.
Best,
Paul

You might also have a look at some pseudo ugens for smooth clipping and folding which are contained in the miSCellaneous_lib quark. You can have a look at the helpfile without installing:

https://pustota.basislager.org/_/sc-help/Help/Tutorials/Smooth_Clipping_and_Folding.html

IMO, folding is a very nice synthesis option, this course material contains a chapter on it

Best

Daniel

1 Like

Yes, I already downloaded miSCellaneous and tried out SmoothFoldS and Q.
Thanks for the material! Really useful.