Separated input from output effects

feature-multitrack
Mike Lynch 2023-04-24 16:49:36 +10:00
parent e249d39f7f
commit a83b8be362
4 changed files with 49 additions and 47 deletions

View File

@ -1,11 +1,10 @@
( (
// audio buses and other control stuff
// recordb = input to bufrecorder //input mixing, effects and lfos
~inputb = Bus.audio(s, 1);
~recordb = Bus.audio(s, 1); ~infxb = Bus.audio(s, 1);
~inmixer = SynthDef( ~inmixer = SynthDef(
\input_null, \input_null,
@ -13,9 +12,8 @@
arg in1 = 2, in2 = 3, out = 4; arg in1 = 2, in2 = 3, out = 4;
Out.ar(out, In.ar(in1) + In.ar(in2)); Out.ar(out, In.ar(in1) + In.ar(in2));
} }
).play(s, [\in1, ~usbinput1, \in2, ~usbinput2, \out, ~recordb]); ).play(s, [\in1, ~usbinput1, \in2, ~usbinput2, \out, ~inputb]);
~grb = Bus.audio(s, 2);
// LFO buses and synths // LFO buses and synths
@ -29,4 +27,31 @@
"LFOs running".postln; "LFOs running".postln;
// filter is now before grains
~filtermodb = Bus.control(s, 1);
~filtermod = SynthDef(
\filtermod, {
arg out, a = 1.0, b = 0.0, c = 0.0;
var siga, sigb, sigc;
siga = In.kr(~lfoab) * a;
sigb = In.kr(~lfobb) * b;
sigc = In.kr(~lfocb) * c;
Out.kr(out, Wrap.kr(siga + sigb + sigc, -1, 1));
}
).play(s, [\out, ~filtermodb, \a, 1, \b, 0, \c, 0 ]);
~filter = SynthDef(
\filter, {
arg in, out, mod, freq=10000, res=0.3, amp=1.0;
var filt, lfo;
lfo = LinExp.kr(In.kr(mod, 1), -1, 1, freq * 0.5, freq * 2);
filt = RLPF.ar(In.ar(in, 2) * amp, lfo, res);
Out.ar(out, filt);
}
).play(s, [ \in, ~inputb, \out, ~infxb, \mod, ~filtermodb, \amp, 0.5], \addToTail);
) )

View File

@ -1,11 +1,10 @@
// this is just output effects now
( (
// output effects mixing and effects
~fxb = Bus.audio(s, 2);
~filterb = Bus.audio(s, 2); ~outfxb = Bus.audio(s, 2);
~grainsb = Bus.audio(s, 2);
~delayb = Bus.audio(s, 2); ~delayb = Bus.audio(s, 2);
~reverbb = Bus.audio(s, 2); ~reverbb = Bus.audio(s, 2);
@ -14,36 +13,10 @@
~grainmixer = SynthDef( ~grainmixer = SynthDef(
\grain_mixer, \grain_mixer,
{ {
arg in=2, gbus=4, out=0, passthrough=0.75, grains=0.75; arg in=2, grainb=4, out=0, passthrough=0.75, grains=1;
Out.ar(out, (grains * In.ar(gbus, 2)) + (passthrough * In.ar(~recordb, 1) ! 2)); Out.ar(out, (grains * In.ar(grainb, 2)) + (passthrough * In.ar(in, 1) ! 2));
} }
).play(s, [\in, ~usbinput, \gbus, ~grb, \out, ~fxb ], \addToTail); ).play(s, [\in, ~infxb, \grainb, ~grainsb, \out, ~outfxb ], \addToTail);
~filtermodb = Bus.control(s, 1);
~filtermod = SynthDef(
\filtermod, {
arg out, a = 1.0, b = 0.0, c = 0.0;
var siga, sigb, sigc;
siga = In.kr(~lfoab) * a;
sigb = In.kr(~lfobb) * b;
sigc = In.kr(~lfocb) * c;
Out.kr(out, Wrap.kr(siga + sigb + sigc, -1, 1));
}
).play(s, [\out, ~filtermodb, \a, 1, \b, 0, \c, 0 ]);
~filter = SynthDef(
\filter, {
arg in, out, mod, freq=10000, res=0.3, amp=1.0;
var filt, lfo;
lfo = LinExp.kr(In.kr(mod, 1), -1, 1, freq * 0.5, freq * 2);
filt = RLPF.ar(In.ar(in, 2) * amp, lfo, res);
Out.ar(out, filt);
}
).play(s, [ \in, ~fxb, \out, ~filterb, \mod, ~filtermodb, \amp, 0.5 ], \addToTail);
@ -58,7 +31,7 @@
del = CombC.ar(sig, maxdelay, delaytime, decaytime, amp); del = CombC.ar(sig, maxdelay, delaytime, decaytime, amp);
Out.ar(out, sig + del); Out.ar(out, sig + del);
} }
).play(s, [ \in, ~filterb, \out, ~delayb ], \addToTail); ).play(s, [ \in, ~outfxb, \out, ~delayb ], \addToTail);
// try taking out the reverb because I think it causes noises // try taking out the reverb because I think it causes noises
@ -72,3 +45,4 @@
"Effects running".postln; "Effects running".postln;
) )

View File

@ -8,6 +8,8 @@
[ "random", \pos_random ] [ "random", \pos_random ]
]; ];
~grainsb = Bus.audio(s, 2);
~granulators = Array.new(4); ~granulators = Array.new(4);
~posb = Array.new(4); ~posb = Array.new(4);
~possynths = Array.new(4); ~possynths = Array.new(4);
@ -22,7 +24,7 @@
(0..3).do({ |i| (0..3).do({ |i|
var pb = ~posb.at(i); var pb = ~posb.at(i);
~granulators.add(Granulator.new(~buflen, ~recordb, ~fxb, pb, ~triggerb, ~pitchb)); ~granulators.add(Granulator.new(~buflen, ~infxb, ~grainsb, pb, ~triggerb, ~pitchb));
}); });
~setmode = { ~setmode = {
@ -38,3 +40,4 @@
"Granulator running".postln; "Granulator running".postln;
) )

View File

@ -12,16 +12,16 @@ Routine.run({
("./synths.scd").loadRelative; ("./synths.scd").loadRelative;
Granulator.init(s); Granulator.init(s);
s.sync; s.sync;
"Synths loaded".postln;
("./control.scd").loadRelative; ("./control.scd").loadRelative;
("./effects.scd").loadRelative; s.sync;
("./granulator.scd").loadRelative; ("./granulator.scd").loadRelative;
s.sync; s.sync;
("./effects.scd").loadRelative;
s.sync;
("./interface.scd").loadRelative; ("./interface.scd").loadRelative;
}); });
) )