[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] automated buffer -- How's that get in there?!?
Hi James (and casual observers!),
I've attempted many alterations and switches and bogus magick, and
haven't been able to get the \filter routine to work (inside the task), but
have noticed a couple things I thought could be wrong. I attempted to alter
them to see if they would fix the problem, but I'm not sure, if they are
incorrect code, what the correct alternative would be. Anyway, here's a
couple observations.
1) - For the synths that are doing the filtering -- here's what I had
previous.
SynthDef(\filterHp, { arg sourcebufnum, targetbufnum, outbus = 0;
var sig = PlayBuf.ar(1, sourcebufnum);
HPF.ar(sig, 1000);
RecordBuf.ar(sig, targetbufnum);
Out.ar(outbus, sig);
Line.kr(0, 1, BufDur.kr(sourcebufnum), doneAction:2);
}).send(s);
Should this synth, and the others like it, have a Line.kr function for the
target buffer as well?
SynthDef(\filterHp, { arg sourcebufnum, targetbufnum, outbus = 0;
var sig = PlayBuf.ar(1, sourcebufnum);
HPF.ar(sig, 1000);
RecordBuf.ar(sig, targetbufnum);
Out.ar(outbus, sig);
Line.kr(0, 1, BufDur.kr(sourcebufnum), doneAction:2);
Line.kr(0, 1, BufDur.kr(targetbufnum), doneAction:2);
}).send(s);
Not sure -- this didn't fix anything by itself, but may be necessary to make
the thing work when we find out what else is wrong.
2) In the Task itself -- The \filter is calling for 2 buffers, one \ready
and one \empty.
r = Task({
var buf1, buf2, node;
loop{
#[\play, \filter].wchoose(#[0.50, 0.50]).switch //#'s define
a literal array -
// wchoose = weighted choose - % follows
{ \play } {
buf1 = ~pool.select({ |b| b.status == \ready
}).tryPerform(\choose);
buf1.notNil.if({
node = Synth(\player,
[\sourcebufnum, buf1.buffer.bufnum]);
~stateManager.value(buf1, node);
});
}
{ \filter } {
buf1 = ~pool.select({ |b| b.status == \ready
}).tryPerform(\choose);
buf2 = ~pool.select({ |b| b.status == \empty
}).tryPerform(\choose);
(buf1.notNil and: { buf2.notNil }).if({
node = Synth(~filters.choose,
[\sourcebufnum, buf1.buffer.bufnum,
\targetbufnum,
buf2.target.bufnum]);
~stateManager.value(buf1, node);
~stateManager.value(buf2, node);
};4.wait;
)};
}});
Here, though, in the 'node =' bit, I've noticed that the '\targetbufnum,
buf2.target.bufnum' is different than the record routine that uses the same
function.
~rec = Routine({
var buf1, buf2, node;
1.do {buf1 = ~pool.select({ |b| b.status == \empty }).tryPerform(\choose);
buf1.notNil.if({
node = Synth(\recorder, [\targetbufnum,
buf1.buffer.bufnum]);
node.debug("started synth");
~stateManager.value(buf1, node);
});5.wait
}
})
)
In the above, the \targetbufnum, buf1.buffer.bufnum' calls for a 'buffer'
after the buf1 not a 'target'.
Should the \filter in the Task do the same?
{ \filter } {
buf1 = ~pool.select({ |b| b.status == \ready
}).tryPerform(\choose);
buf2 = ~pool.select({ |b| b.status == \empty
}).tryPerform(\choose);
(buf1.notNil and: { buf2.notNil }).if({
node = Synth(~filters.choose,
[\sourcebufnum, buf1.buffer.bufnum,
\targetbufnum,
buf2.buffer.bufnum]);
//changed the above to
buf2.buffer.bufnum from buf2.target.bufnum
~stateManager.value(buf1, node);
~stateManager.value(buf2, node);
};4.wait;
If these changes are correct and necessary, then there is still something
else which is broken --
I'd appreciate your comments on the above!
Many thanks,
-S
--
View this message in context: http://www.nabble.com/automated-buffer----How%27s-that-get-in-there-%21--t1030376.html#a3252060
Sent from the Supercollider - User forum at Nabble.com.