[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-users] Can't wrap my head around SynthDef.wrap
Hello all,
I'm trying to use SynthDef.wrap for hiding some of the complexity for
generating synths with the same set of parameters, envelopes etc. I'm
trying to build a class that will get a function as an input and inject
that function into a predefined synthdef structure.
I want the arguments of the supplied function to act like the arguments
of the SynthDef so I can access them via OSC but can't ".wrap" my head
around it.
My shot was something like this, a blank synthdef for now and a function:
(
f =
{
arg name, func;
SynthDef(name,
{
var out = SynthDef.wrap(func, 0.dup(func.def.argNames.size),
func.def.argNames);
Out.ar(0, out);
}).send(s);
};
)
f.value("siner", { arg freq = 440; SinOsc.ar(freq); });
It doesn't compile, I was not really expecting it to work but maybe
someone can help. I want this freq argument supplied in the function to
act as an argument for the SynthDef. I want to be able to add
arbitrarily named arguments that way (to the function) that will act the
same way. How can I achieve this?
Thanks,
BB.
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/