determine total number of voices from inside a poly~

    Jul 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?

    • Jul 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
    • Jul 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:
      Then try this:
      The t inside the poly~ detected zero's as arguments. Did I overlook something obvious?
    • Jul 14 2006 | 4:45 pm
      [poly~ 1 args 1 2 3]
      The gory details of poly~'s arguments can be found in the "optional-arguments" subpatch of poly~'s help file.
    • Jul 14 2006 | 10:38 pm
      i control variables of abstractions inside [poly~] with send/receive or send~/receive~
      it takes all of us
    • Jul 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.
    • Jul 17 2006 | 3:35 pm
      you could have a loadbang in each voice send a bang via a send/receive
      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
      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)
    • Jul 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.