[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Re: all audio explodes when trying to trig record clean feed via groups



Hey James,

Thanks for these suggestions, super helpful. I made the changes you suggested and then after some tweaking I now have things working. One odd thing I noticed is that certain UGens ask for a Buffer.index but seem to want a Buffer.bufnum instead (?) and throw errors about not understanding the Buffer.index until this change is made (see rec_manual where i use ~loopbuf1.bufnum instead of ~loopbuf1.index for one example).

Thanks again!

Casey

P.S. Here is where I ended up (for anyone else coming to this later):

Groups:

(

// Create 3 groups and 2 busses

~clean = Group.new;
~looped = Group.after(~clean);
~finalMix = Group.after(~looped);

~cleanBus = Bus.audio(s, 1);
~loopedBus = Bus.audio(s, 1);


// 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);

)


(

// make the synth that does this

m = { arg cleanAmp = 0.5, loopedAmp = 0.5;
    var clean, looped, sig;
    clean =  In.ar(~cleanBus.index, 1) * cleanAmp;
    looped = In.ar(~loopedBus.index, 1) * loopedAmp;
sig = clean + looped;
Out.ar([0,1], sig);
}.play(target: ~finalMix);

)

(

// run it

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:

MIDIIn.connectAll;

(

~loopbuf1 = Buffer.alloc( s, s.sampleRate * 60, 1, completionMessage: { ("Loaded ~loopbuf1! numFrames: " + (s.sampleRate * 60)).postln } ); // for rec_manual
~bDur = 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, trig = 0 |
var env, in, phase, time;

in = In.ar( inBus, 1 );
phase = Phasor.ar(trig, 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( 1, buf, 1, trig, start, start, end, 2);
Out.ar( outBus, env * play );
}).add;

)

////////////////// RECORD AND LOOP THE THINGS //////////////////

///////// manually /////////

// 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.9, \buf, ~loopbuf1.bufnum, \inBus, ~cleanBus.index, \recManualBus, ~bDur.index, \trig, 1 ], ~looped);
},
{
( num + "STOP REC" ).postln;
~loopt1.set(\off, 1);
~i = Synth.new(\looper, [\amp, 0.90, \buf, ~loopbuf1.bufnum, \end, ~bDur.asMap, \outBus, ~loopedBus.index, \trig, 1 ], ~looped);

});

}, 48); // match #48


)

On December 29, 2017 at 3:17:40 PM, jamshark70@xxxxxx (jamshark70@xxxxxx) wrote:

casey.thomas.anderson wrote
> 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.

A couple of useful troubleshooting tricks: .trace your synths to check that
the Control inputs, and Out buses, are what you expect. Or use the "dump
node tree with controls" IDE menu command to check the controls with minimum
extra noise in the post window.


> // for the gui
>
> ~window; ~s1; ~s2; ~s3;

No need, ~envirVars don't need to be declared.

Otherwise, the groups and buses look fine.

(
// 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);
)

1. {}.play makes its own Out, no need for you to do it. No harm either, but
you could write "clean + looped" here.

2. Out.ar([0, 1], aStereoSignal) is wrong. Very common mistake. You're
actually getting a 3-channel signal from this: [left, left + right, right].
I'd suggesting breaking that habit before it becomes a habit.

GUI seems ok.


> Out.kr( recManualBus, time );
>
> // but
>
> ~loopt1 = Synth.new( \rec_manual, [
> \amp, 0.50, \buf, ~loopbuf1, \inBus, ~cleanBus.index, \recManualBus,
> ~loopbDur1.asMap ]);

recManualBus needs to be a bus index, to use with Out.kr -- but asMap means
it will receive the bus *value* instead. I think you need to remove asMap
here.

I didn't run your code so I'm not sure about other problems, but there's
one.

hjh



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/