Using [js] to create normalized [buffer~]s?

Aug 5, 2010 at 2:50pm

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

- Jon

Attachments:
  1. autobuffer1.txt
#51661
Aug 5, 2010 at 8:57pm

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

#185373
Aug 6, 2010 at 12:47am

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
function filepath(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);
//report last
bang();
}

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.

best regards,

- Jon

#185374
Aug 6, 2010 at 1:14am

It’s not JS, polybuffer~ is a whole new MSP object by EJ which does it all for you.

http://cycling74.com/forums/topic.php?id=26356

is your friend

There is no access to buffer~ data from JS anyway.

-A

#185375
Aug 6, 2010 at 4:02am

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.

- Jon

#185376
Aug 6, 2010 at 9:55am

As Andrew mentioned, you won’t be able to access to the samples directly in JavaScript. However you can probably script everything. For instance if you look at 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.

#185377

You must be logged in to reply to this topic.