poly~ send message to most recent voice


    Sep 11 2015 | 8:18 am
    Hey folks,
    I'm struggling (once more) with the poly~ object and it's built in voice management. Everytime I use it in a project I find a different solution which never satisfies me entirely so I guess it's time for some input.
    Let's imagine having a sampler which is a note on/off sampler (no one shot). When a note is pressed on the keyboard, it chooses the corresponding buffer and provides some further information, flags like "follow velocity on/off", "gain", "output channel" etc. The information is provided from outside the poly~ and sent to a second poly~ inlet. The poly~ does it's voice allocation via "midinote" message and here the struggle begins. How do I provide the mentioned additional information through the second inlet to the correct voice? Messages sent to inlet 2 are always ending up in the first voice not the last one used, unless I specify it via "target xy" which is not possible since I don't know (do I, apart from the ID?) which voice this particular note is occupying. Another approach would be to do the voice allocation all by myself via "target". Then I would need to store every note and the target it was sent to in order to get the note-off message to the right voice which is not really satisfying as well.
    What I'm currently doing as a workaround is using "forward" and "receive" objects combined with the #0 message to get each voices ID. So when a note is triggered the poly~ sends the corresponding voice ID out to the main patch where this information is fed into a "forward" object (inst_#0) to send the buffer/velocity/gain/... information to a receive object (inst_#0) in the poly~. In this way I make sure the information is send to the last note triggered. It works but still seems to be a complicated solution for a basically quite simple task.
    Placing the list with the buffer/velocity/... information inside the poly~ is not an option since this sampler is only one amongst others. It all has to be controlled from one master list (a coll or maybe IRCAM's antescofo) and cannot be spread into several lists. This is usability reasons since I'm not the one who will be using the patch.
    Am I missing something essential? How would you solve that problem?
    thank you Dominik
    P.S. I'm not quite sure if this thread should be labeled "beginner" of "advanced". I'm definitely no beginner but I have the feeling there is a very simple solution which I'm just not able to see.

    • Sep 11 2015 | 9:03 am
      Why don't you sand the extra information as a list with the "midinote" message? You are using it already, it can carry a list into the voice, not only pitch and velocity.
      Sorry for not being more detailed, I am in a hurry!
      Nik
    • Sep 11 2015 | 10:09 am
      That's it! I thought about that once but for some reason never actually tried if it's possible. There it is, the simple solution...
      thank you!
    • Sep 28 2015 | 6:42 pm
      Actually I just ran into a case where the "midinote" method seems to hit the wall as well. If I have a sampler where samples are triggered with a note on and keep playing until the next note on of the same pitch arrives. All note offs are ignored/removed via stripnote. Since the currently playing voice is marked "busy" the next note on of the same pitch (which should stop the playback) can't be sent to the right voice. Once again I would need to program a structure which allocates voices manually and keeps track of which pitch plays on which voice in order to be able to turn them off with a second note on. At the moment I'm using javascript as a solution although I normally try to avoid that...
    • Dec 26 2015 | 11:52 pm
      I'm running into a similar problem, but I think my situation is a bit simpler...I'm just playing back buffers within a poly~ but some of the voices need to crossfade into each other. I think the answer to finding what the previous targeted voice is using busymap. I use [zlsum] to add the previous number of busy voices from the list in the busymap message – since each of my buffers plays a one shot and then is freed after it's done playing, the number will tell me what the voice I need to target for crossfading is (the most recently playing one...)
      You could sort the list first using [zl sort] and then use the "sort indexes" to find which voices are free....first part of the list (0s) are free, second part of the list (1s) are busy...hope this helps
    • Dec 27 2015 | 9:53 am
      the OP wrote:
      The poly~ does it’s voice allocation via "midinote" message and here the struggle begins.
      there lies his and your solution; do the voice management completely outside the poly and you gain full control over everything.
      -110