Forums > MaxMSP

determine total number of voices from inside a poly~

July 13, 2006 | 3:34 pm

Hi everyone,

A simple question: inside an abstraction loaded into poly~, is it possible to determine the total amount of poly~’s voices?

I vaguely remember seeing some #X that is replaced by the total amount of voices when the abstraction is loaded into poly~, but I can’t find anything in the help files or archives. Can someone help me out?

Cheers,
Mattijs


July 13, 2006 | 5:37 pm

[poly~] second argument denotes the number of instances (voices)

#n can be used inside your abstraction for argument variables – see topics and tutorials "$ and #"

it takes all of us
LoneMonad

http://faculty.roosevelt.edu/malone/downloads.htm


July 14, 2006 | 10:53 am

Thanks for your reply. #n works in abstractions but it doesn’t seem to work inside poly~. I tried the following:

Save as insidepoly:
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 38 60 62 196617 t $1 $2 $3;

Then try this:
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 110 44 92 196617 poly~ insidepoly 2;
#P newex 23 44 82 196617 insidepoly 1 2 3;

The t inside the poly~ detected zero’s as arguments. Did I overlook something obvious?

Thanks,
Mattijs


July 14, 2006 | 4:45 pm

Try

[poly~ 1 args 1 2 3]

instead.

The gory details of poly~’s arguments can be found in the "optional-arguments" subpatch of poly~’s help file.

hth,
Owen


July 14, 2006 | 10:38 pm

i control variables of abstractions inside [poly~] with send/receive or send~/receive~

it takes all of us
LoneMonad

http://faculty.roosevelt.edu/malone/downloads.htm


July 17, 2006 | 2:57 pm

Thanks Owen,

That works. Pity though that now I have to do
[poly~ grain~ 16 args 16], where the 16′s are always the same, but I can live with that.

> i control variables of abstractions inside [poly~] with send/receive or send~/receive~

Yeah, me too normally, but I wanted this to be a black box where it would be enough to set the amount of voices. The grain patcher inside needs its phase to be set according to the amount of voices.

Anyway, thanks guys, this will do fine.
Mattijs


July 17, 2006 | 3:35 pm

you could have a loadbang in each voice send a bang via a send/receive
connex.
since the send/receive pair could be like a global variable. each
voice would bang a counter and that would tell you how many voices you
have.

there have got to be > 1*10^999 ways to get info on the state of your
poly~ abstractions…

the args way mightbe the easiest, but if you need a dynamic way of
dealing with the number of voices you could use thispoly~ and its mute
state to allow the number of *active* voices to be known too…

also you could probably come up with a phase setting scheme that was
independent of total voice count. for example use a hashtable where
the voice number from thispoly~ would call a phase value.
1, 0
2, 180
3, 90
4, 45
5, 135
6, 22.5
7, 67.5
8, 112.5
9, 157.5
10, (keep splitting the differnce)


July 17, 2006 | 5:02 pm

you are propably right. The best way though would be if thispoly~ would simply output the total voice amount on bang. < -- this is actually a feature request, cycling!

Cheers,
Mattijs


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