Trying to normalize a polybuffer~ created in js
Hello,
I'm trying to figure out the exact syntax to send a "normalize" message to a polybuffer~ that I've created in javascript.
Based on this bit in the polybuffer/js help patcher:
// dynamically send any message to the polybuffer~ object
if (arguments.length > 0) {
eval("pb." + messagename + "(arrayfromargs(arguments))");
Sending the message "0 normalize 0.1" to the above acts as expected.
So, I've been trying variations on this:
eval("pb.send" + "(0, "normalize", 0.1)" );
This returns an error: js:Javascript SyntaxError: missing ) after argument list
(which is over my head, as the parentheses seem in order)
Tried this:
eval("pb.send(" + (0, "normalize", 0.1) + ")");
(no error but does nothing)
eval("pb.send "+ ("(0, "normalize", 0.1)"));
returns js: Javascript SyntaxError: missing ) in parenthetical, line 44
I have basically been through every imaginable combinations of quotes and parentheses I can think of. Anybody have an idea of the right way to write this?
Thanks!
\M
I'm encountering this behavior six years later
FWIW, although I had kind of forgoten about this, looking up some ld code, it looks like I never figured it out...
\M
var pb = new PolyBuffer("samples");
pb.send(0, "normalize", 0.1)