record to different buffer in each poly~ instance ?

May 31, 2009 at 5:33am

record to different buffer in each poly~ instance ?

I want to make a patch that can record different stuff in each poly~ instance for further process (e.g. to create a poly looper), but I noticed that each poly~ instance should look exactly the same. If so, there is no way to name the buffer differently inside each instance to achieve my goal. I was wondering if there is any way to make it happen.

Please help.

Thank you so much.

#44175
May 31, 2009 at 8:34am

you can _rename the buffer from _outside the poly patcher.

example:

“target 5″,
“set”,
“set buffer-005″

-110

#158744
May 31, 2009 at 9:09am

Or you could use the #0 argument to name the buffer~ and then send the specific name of each buffer out of poly~

– Pasted Max Patch, click to expand. –
#158745
May 31, 2009 at 10:01am
david stevens wrote on Sun, 31 May 2009 03:09
Or you could use the #0 argument to name the buffer~ and then send the specific name of each buffer out of poly~

Thank you for the example. But I still can’t figure out how you make #1, #2… become different numbers. I know in an abstraction, I can specify arguments beside the name of the abstraction in the main patch to make #1, #2, etc. become numbers inside an abstraction. But for poly~, where do you specify the number for the variable ? Could you explain a little bit ?

Thank you so much.

#158746
May 31, 2009 at 10:40am

You could also use the instances’numbers with something like that

[loadbang] -> [thispoly~] -> [sprintf set buffer%i]

ch.

#158747
May 31, 2009 at 10:41am
Cheng Chien-Wen wrote on Sun, 31 May 2009 12:01
But I still can’t figure out how you make #1, #2… become different numbers.

no, only #0 becomes different numbers, not #1.

try it in a test subpatcher before you use it in
poly, and you will see how it works.

you would do something like that in your poly:

[loadbang]
|
[i #0]
|
[prepend buffername]
|
[sprintf %s%s]
|
[prepend set]
|
[t l set]
| |
[buffer~ noname]

this will do the same as if there would be buffers with
different names in different voices of the poly~ :

[buffer~ buffername1667]
[buffer~ buffername1668]
[buffer~ buffername1669]

you would also have to send out those buffernames
to the parent patcher.

it is somewhat more complicated
than setting buffernames from outside the poly, but it
works well, too.

setting stuff from outside has the advantage that
the outside world already knows the names, and you
can also change names, buffersize, and samples from
disk that way.

#158748
May 31, 2009 at 10:44am

After some experiments, I noticed that #0 will become some number inside different instance of poly~ automatically in Max/MSP 5 without having to specify it somewhere. I don’t know how it happens, but it does not happen in Max/MSP 4.6.

#158749
May 31, 2009 at 10:52am

The #0 variable is special. When you load the patch containing your poly~, each instance of #0 is replaced by a number, in sequence. So if you load the (incomplete) patch I posted in a poly~, and then open the various voices ( send open 1, open 2 etc messages to the poly~), you’ll see something like

buffer~ 4065_Sunday
buffer~ 4066_Sunday
buffer~ 4067_Sunday

etc etc

You’ll also see the same name in the message box that I use to send the buffer name out of the patch, and if you drill down into the granular player, the same name in the play~ objects at the core of that part of the patch.

(Try it out – there might be some 3rd party objects missing, but you’ll see how the numbering system works).)

1 second after the poly~ is loaded, the name of each patch is sent out of outlet 3 (if I remember correctly). The names are all collected in a temporary [coll] connected to output 3 of the poly~. I can then refer to this coll for any process I want to run from outside the poly~.

The polyphony in my patch is fixed, so the names stay constant once the patch is loaded. I think if you change the polyphony the numbers will all change, so if you use this method you’ll need to resend them out of the poly~.

Does that make sense?

#158750
May 31, 2009 at 10:55am

ch wrote:

>You could also use the instances’numbers with something like that
>[loadbang] -> [thispoly~] -> [sprintf set buffer%i]

That’s cool. I hadn’t thought of that.

David

#158751
May 31, 2009 at 11:24am

yes, [thispoly~] is really usefull.
the advantage over the #0 is that you know the buffers’names from the outside.

Ch.

#158752
May 31, 2009 at 11:57am
david stevens wrote on Sun, 31 May 2009 12:52
buffer~ 4065_Sunday

if you do [buffer~ #0_Sunday], you will not know
the buffer names, which makes the usage of them
a bit difficult.
Smile

#158753
May 31, 2009 at 2:16pm
Cheng Chien-Wen wrote on Sun, 31 May 2009 12:44
After some experiments, I noticed that #0 will become some number inside different instance of poly~ automatically in Max/MSP 5 without having to specify it somewhere. I don’t know how it happens, but it does not happen in Max/MSP 4.6.

The #0 substitution happen when the poly~ instantiate all its patchers. This works in both Max 4.x and 5.x (look at poly~ help file).

If you want communication within a poly~ instance without any interaction with the outside #0 is definitely the easiest way IMHO.

#158754
May 31, 2009 at 2:53pm

Roman wrote:

> if you do [buffer~ #0_Sunday], you will not know
the buffer names, which makes the usage of them
a bit difficult.

Not at all! The way I work that is to also have a message box with #0_Sunday in it (you can see this is the patch I uploaded earlier in the thread). The #0 in the message box gets exactly the same number as the buffer~ (that’s the first thing I checked), and I then bang the message box to send the name out of one of the poly~ outlets and collect them in a coll. It may not be the most elegant way to do it, but it works!

DAvid

#158755
May 31, 2009 at 3:03pm

yeah of course, you can have it beside AND in the
buffer objects box, i overlooked that.

however, i seem to be the only one here who is
doing such things always outside the polys or
abstractions.
maybe only because i never used the thispoly
voice info?

-110 *looks into his patches*

#158756
May 31, 2009 at 7:24pm

if you want to supply arguments to poly~, you have to start with the word ‘args’. So if your arguments were buffer name and size, a 4 voice poly with one second buffers would be

[poly~ 4 args buffName 1000]

#158757

You must be logged in to reply to this topic.