Skip to content

Instantly share code, notes, and snippets.

@ahihi
Last active April 26, 2022 17:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahihi/155e264641faacdc10c7b6dd3df791a3 to your computer and use it in GitHub Desktop.
Save ahihi/155e264641faacdc10c7b6dd3df791a3 to your computer and use it in GitHub Desktop.
SuperDirt mid/side mixer module
(
SynthDef("pulu-midside2", { |out, mid=1, side=1, mspan=0.5|
var sig, left, right, midsig, sidesig;
sig = In.ar(out, 2);
left = sig[0];
right = sig[1];
midsig = (left + right)*0.5*mid;
sidesig = (right - left)*0.5*side;
sig = [midsig - sidesig, midsig + sidesig];
sig = DirtPan.ar(sig, 2, mspan.linlin(0, 1, -1, 1));
ReplaceOut.ar(out, sig);
}).add;
~dirt.addModule('pulu-midside', { |dirtEvent|
dirtEvent.sendSynth('pulu-midside' ++ ~dirt.numChannels, ~argNames);
}, { ~mid.notNil || ~side.notNil || ~mspan.notNil });
~dirt.orderModules(['sound', 'pulu-midside']);
)
-- here's a synth with a wide stereo field
d1 $ n "<~ [0,3,6]>*8" # s "superprimes"
-- make it mono by removing the side signal
d1 $ n "<~ [0,3,6]>*8" # s "superprimes" # pF "side" 0
-- or maybe just make it a little narrower
d1 $ n "<~ [0,3,6]>*8" # s "superprimes" # pF "side" 0.5
-- removing the mid signal could be fun sometimes
d1 $ n "<~ [0,3,6]>*8" # s "superprimes" # pF "mid" 0
-- unfortunately this breaks SuperDirt's panning because the mid/side module comes after it...
d1 $ n "<~ [0,3,6]>*8" # s "superprimes" # pF "side" 0 # pan rand
-- ...so i added another panning stage, controlled by mspan
d1 $ n "<~ [0,3,6]>*8" # s "superprimes" # pF "side" 0 # pF "mspan" rand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment