Hi all,
I am trying to use groups to split up different parts of my live stuff and currently have this kind of arrangement:
clean feed (synths controlled via xy controller)looped feed (gets clean feed)master feed (gets clean and looped feed)
Right now when I try to trigger record (via midi controller) on my rec_manual synth i lose all audio and, upon turning the rec_manual synth off all audio is distorted/messed up. The clean feed does end up getting recorded in the buffer either. I am a little stumped as to what I am doing wrong here, does anyone see what I am doing wrong here? (FYI, clean feed code was left out but goes into a bus called ~cleanBus):
groups first:
(
// Create 3 groups and 2 busses
~clean = Group.new;~looped = Group.after(~clean);~finalMix = Group.after(~looped);
~cleanBus = Bus.audio(s, 2);~loopedBus = Bus.audio(s, 2);
// control busses for volume
~cleanBusVol = Bus.control(s, 1).set(0.0);~organBusVol = Bus.control(s, 1).set(0.0);~loopedBusVol = Bus.control(s, 1).set(0.0);
// for the gui
~window; ~s1; ~s2; ~s3;
)
(
// make the synth that does this
m = { arg cleanAmp = 0.5, loopedAmp = 0.5;var clean, looped, organ;clean = In.ar(~cleanBus, 2) * cleanAmp;looped = In.ar(~loopedBus, 2) * loopedAmp;Out.ar([0, 1], clean + looped);}.play(target: ~finalMix);
m.set(\cleanAmp, ~cleanBusVol.asMap, \loopedAmp, ~loopedBusVol.asMap);
)
// setup GUI(
~window = Window.new("mixer", Rect(0,0,600,640)).onClose_({"closing".postln;});
~s1 = Slider.new(~window, Rect(10, 10, 50, 200)).action_({ |slider|("clean bus vol = " + slider.value).postln;~cleanBusVol.set(slider.value);});
~s2 = Slider.new(~window, Rect(70, 10, 50, 200)).action_({ |slider|("loop bus vol = " + slider.value).postln;~loopedBusVol.set(slider.value);});
~s3 = Slider.new(~window, Rect(70, 10, 50, 200)).action_({ |slider|("organ bus vol = " + slider.value).postln;// ~organBusVol.set(slider.value);});
~window.front;
)
looper below:
MIDIIn.connectAll;
~loopbuf1 = Buffer.alloc( s, s.sampleRate * 60, 2, completionMessage: { ("Loaded ~loopbuf1! numFrames: " + (s.sampleRate * 60)).postln } ); // for rec_manual~loopbDur1 = Bus.control(s, 1); // used to share off time from phasor (see rec_manual)
(
// records until an off message which latches phasor location, frees self on latch
SynthDef( \rec_manual, { | amp = 0.0, buf, inBus, rate = 1, recManualBus, off = 0 |var env, in, phase, time;
in = In.ar( inBus, 2 );phase = Phasor.ar(0, BufRateScale.kr(buf) * rate, 0, (BufFrames.kr(buf)));BufWr.ar(in, buf, phase);time = Latch.kr(phase, off);Out.kr( recManualBus, time );FreeSelf.kr( time );}).add;
SynthDef( \looper, { | amp = 0.99, buf, end, outBus, rate = 1, start = 0, trig = 1 |var env, play;
env = EnvGen.kr( Env.asr( 0.01, amp, 0.01 ), trig, doneAction: 2 );play = LoopBuf.ar( 2, buf, 1, trig, start, start, end, 2);Out.ar( outBus, env * play );}).add;
)
// trig by midifighter(MIDIdef.cc(\test1, {arg ...msg;var vel, num, chn;vel = msg[0];num = msg[1];chn = msg[2];
if( vel == 127, {( num + "START REC" ).postln;~loopt1 = Synth.new( \rec_manual, [\amp, 0.50, \buf, ~loopbuf1, \inBus, ~cleanBus.index, \recManualBus, ~loopbDur1.asMap ]);},{( num + "STOP REC" ).postln;~loopt1.set(\off, 1);
});
}, 48); // match #48
)