Problem with adsr~ and poly~

    Jan 03 2012 | 5:06 pm
    Started this patch last night, and what I thought would be simple has turned into a large problem. I want my patch to be polyphonic, and for the sustain of each note to correspond to the length of time a note is held. However, I can't seem to get the poly~ and the adsr~ to play nice. The polyphony abstraction works, but only with a fixed sustain time. I am using the Velocity outlet of the notein object to trigger the adsr~. This would work in a monophonic patch, but when sent to the poly~, the messages are out of sync, causing the adsr~ to switch off when a note is played, and on when it is released.
    Sorry for the spotty explanation, I have attached the patch and abstraction. I'm sure there is a simple fix for this I have overlooked and thanks in advance for any help given.

    • Jan 03 2012 | 5:35 pm
      Check out the poly~ tutorial on this site. You should be able to modify the demo patchers to get what you want here. Let me know if that isn't adequate.
    • Jan 03 2012 | 6:41 pm
      Thanks, I checked out the tutorial and created a new patch based on it. While I now understand adsr~ better, I have run into a new problem. I can now have the adsr~ and poly~ working together, when I try to add my voice selector (cycle~, saw~ etc.), the polyphony stops working and I am unsure as to why.
      I used a selector object in the ProjectPoly abstraction, should I be doing something differently?
    • Jan 03 2012 | 6:47 pm
      I have a couple of poly~ example patches that you might want to take a look at. I would start with StupidSynth, which can be found here.
      I have a somewhat more sophisticated synth called Simple_FM_Synth, which can be found here.
    • Jan 03 2012 | 6:52 pm
      Modify your poly~ with the @target 0 attribute.
    • Jan 03 2012 | 7:00 pm
      Yeah, Chris is right, anytime you want to send data into a poly~ object, you need to specify which voice ("target 1, 2, 3, etc.") or all voices ("target 0").
      I'm not 100% clear on how this works. Chris, can I just send the target message to a particular inlet once?
    • Jan 03 2012 | 7:05 pm
      You can either send it via a message, or use the attribute "@target 0"
    • Jan 03 2012 | 7:12 pm
      Okay, so when I send it to one inlet, I'm sending it to all inlets? And when I set the attribute, I'm setting it for all inlets? So if I want to send a different value to each voice, I have to change the target value/attr before I send each value?
    • Jan 03 2012 | 7:21 pm
      Thank you, that fixed it. I feel like I should've noticed that, but to be honest, I never would have done that myself. I'll take a look at those examples as well.
    • Jan 03 2012 | 7:36 pm
      To use a different value for each voice, include the value in a note or midinote message. These messages are typically a pitch-velocity list, but they can be as long as you need to send all the parameters.
      The MIDI pitch number is used to allocate voices, which is why the mtof object is usually inside poly~.
      Check out the adsr~ help patch.
    • Jan 04 2012 | 2:18 pm
      Oh that is awesome. Thanks!