Mid-Side control and "Wider" SynthDefs

Just sharing some Synthdefs I've made and have been shared in the Discord, but not documented anywhere else. So I'm leaving them here for everyone to use:


Side

Balances between the mid and the side of the stereo signal. Receives values from -1 to +1 (0 being unnafected signal, -1 mid and +1 side), but I like to set it on Tidal such that I use values from 0 to 1
(0.5 being unnafected, 0 mid and 1 side).

(
~dirt.addModule('side', { |dirtEvent|
	dirtEvent.sendSynth('side2')
}, { ~side.notNil });

SynthDef("side2", { |out, side = 0, sustain|
	var signal = In.ar(out, 2);
	var ms = Balance2.ar(signal[0] + signal[1], signal[0] - signal[1], side);
	signal = [ms[0] + ms[1], ms[0] - ms[1]] * sqrt ( (side.max(0)+1)/2 );
	ReplaceOut.ar(out, signal);
}).add;
);
let side n = pF "side" $ ((n-0.5)*2)

Wider

Widens any signal, even if mono. Replicates the behaviour of the original Wider plugin. It applies a bit of a comb filter to one side, and the inverse of the filter on the other side. So it accentuates the frequences it lowers from one side and vicecersa. This means the signal is still mono compatible.

(
~dirt.addModule('wider', { |dirtEvent|
	dirtEvent.sendSynth('wider' ++ 2)
}, { ~wider.notNil });

SynthDef("wider" ++ 2, { |out, wider = 0, sustain|
	var signalL = In.ar(out, 1);
	var signalR = In.ar(out+1, 1);
	var maxdt = 1/44100*32; var mindt = 1/44100*24;
	var dt = wider * (mindt-maxdt) + maxdt;
	var left =  (signalL + DelayL.ar(signalL,dt,dt,wider));
	var right = (signalR - DelayL.ar(signalR,dt,dt,wider));
	ReplaceOut.ar(out, [left,right]);
}).add;
);
let wider = pF "wider"
2 Likes