Using [js] to create normalized [buffer~]s?
I am attempting to use a [js] object to create and load a normalized (to -.2 dB) series of [buffer~] objects within a patcher. I’m able to create pre-loaded [buffer~]s but how would one go about sending an accompanying normalization command.
Attached is the contents of my [js] object.
Any help would be much appreciated
I would do that using polybuffer~:
- send the readfolder message
- then, send 0 normalize 0.794328 (which sends the message normalize 0.794328 to every buffer~ objects).
you’re done ;-)
I’m confused as to where to put that information in the [js] and how. I am going to guess that it goes somewhere in this part of the code:
//after each successive new path
currentfilepath = path;
buffname = "thisbuff_" + count; // create a new name based on the count
p = this.patcher;
a = p.newdefault(200,ypos,"buffer~",buffname,currentfilepath);
I am very hazy as to the syntax needed to talk to other max objects. I will try to implement your advice but I am most likely going to need clarification.
It’s not JS, polybuffer~ is a whole new MSP object by EJ which does it all for you.
is your friend
There is no access to buffer~ data from JS anyway.
Thank you for the advice. The [polybuffer~] object looks great though I am looking for a purely [js] object solution. One of the reasons is that I am trying to expand my js/max knowledge. I imagine sending an accompanying normalize message to a [buffer~] from a [js] would be simple but I am clueless.
this.patcher.apply you should be able to iterate through the object, test
theObject.maxclass to see if the object is a buffer~ and send the normalize message. Have fun.