Problem with adsr~ and poly~

Jan 3, 2012 at 5:06pm

Problem with adsr~ and poly~

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.

Attachments:
  1. Polyphony.maxpat
#60988
Jan 3, 2012 at 5:35pm

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.

#219718
Jan 3, 2012 at 6:41pm

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?

Attachments:
  1. ProjectPoly.maxpat
#219719
Jan 3, 2012 at 6:47pm

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.

#219720
Jan 3, 2012 at 6:52pm

Modify your poly~ with the @target 0 attribute.

#219721
Jan 3, 2012 at 7:00pm

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?

#219722
Jan 3, 2012 at 7:05pm

You can either send it via a message, or use the attribute “@target 0″

#219723
Jan 3, 2012 at 7:12pm

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?

#219724
Jan 3, 2012 at 7:21pm

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.

#219725
Jan 3, 2012 at 7:36pm

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.

#219726
Jan 4, 2012 at 2:18pm

Oh that is awesome. Thanks!

#219727

You must be logged in to reply to this topic.