Wavetable stretch/squeeze

Was thinking about the (perhaps overused) wavetable stretching / squeezing effect (as in Vital softsynth, right-hand modulator knob “Squeeze”). This works quite well.

(
// symmetrical wavetable (I guess doesn't have to be symmetrical, but ok...)
s.waitForBoot {
	c = Pbrown(-1.0, 1.0, 0.25, 1024).asStream.all;
	d = Pseries(0, 1/1023, 1024).sqrt.asStream.all;
	e = (c * d) + (c.reverse.neg * d.reverse);
	e = Signal.newFrom(e).normalize;

	b = Buffer.sendCollection(s, e.asWavetable);
}
)

(
a = {
	var freq = 50;
	var center = MouseY.kr(0.1, 0.9, 0);
	var curve = MouseX.kr(-6, 6, 0);
	
	var phasor = Phasor.ar(0, freq * SampleDur.ir, 0, 1);
	var phase = 2pi * Select.ar(
		phasor > center,  // right-hand branch will be second in array
		[
			phasor.lincurve(0, center, 0, center, curve),
			phasor.lincurve(center, 1, center, 1, curve.neg)
		]
	);
	
	var sig = Osc.ar(b, 0, phase);
	(sig * 0.1).dup
}.play;
)

hjh

4 Likes