Forums > MaxMSP

record to different buffer in each poly~ instance ?

May 31, 2009 | 5:33 am

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.


May 31, 2009 | 8:34 am

you can _rename the buffer from _outside the poly patcher.

example:

"target 5",
"set",
"set buffer-005"

-110


May 31, 2009 | 9:09 am

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. –

May 31, 2009 | 10:01 am
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.



Ch
May 31, 2009 | 10:40 am

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

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

ch.


May 31, 2009 | 10:41 am
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.


May 31, 2009 | 10:44 am

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.


May 31, 2009 | 10:52 am

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?


May 31, 2009 | 10:55 am

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



Ch
May 31, 2009 | 11:24 am

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

Ch.


May 31, 2009 | 11:57 am
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


May 31, 2009 | 2:16 pm
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.


May 31, 2009 | 2:53 pm

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


May 31, 2009 | 3:03 pm

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*


May 31, 2009 | 7:24 pm

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]


Viewing 15 posts - 1 through 15 (of 15 total)