Pitch Envelope via [function]

Dec 2, 2011 at 12:06am

Pitch Envelope via [function]

I’m kicking myself because I know this is very simple and I even solved it a few months ago but now I can’t remember what I did and I lost my patch! Basically I’m just trying to create a pitch envelope/glissando via the function object and I can’t seem to figure out how to get a completely smooth ramp. Ideally I need the function’s line list to come out as floats instead of signal using line~. Basically doing exactly what you would do with the line object and a message but with function instead of the message. Why can’t I get this?

– Pasted Max Patch, click to expand. –
#60404
Dec 2, 2011 at 12:17am

[rampsmooth~] Is that all you’re missing?

#217359
Dec 2, 2011 at 12:43am

Nope, that doesn’t do it.

Can [line] not work with [function] the way [line~] does?

#217360
Dec 2, 2011 at 1:40am

Nope, it unfortunately can’t. There are several third party objects that do this. I think there’s on in the ejies, and there’s also one called lines.

That said, this may not be a situation that calls for that. My general rule of thumb is that I only use snapshot~ if there’s a highly compelling reason to downsample to control rate, knowing all the irregularity of timing that comes with it, and I generally prefer to use snapshot~ only when I’m triggering it with a bang, so I’m not adding a bunch of events to the scheduler that I may or may not need.

In my experience, this is the type of operation that can be done at signal rate without a huge penalty. Here’s an example that uses matrix~ to do that. It also enables you to do all manner of other crazy things such as frequency shifting particular partials, etc. if you add more inlets. If you’re concerned about CPU usage, you could downsample the hell out of the matrix~ part using poly~ (well, that’s the Max5 way, there may be something newer with Max6)

In terms of math, I’d totally recommend vexpr. It takes some getting used to, but once you get it, you can do a ton of operations with minimal effort, and this is really helpful on an additive synth.

Anyways, pardon the verbosity, but I hope this can be helpful.

– Pasted Max Patch, click to expand. –
#217361
Dec 2, 2011 at 1:46am

You need to give snapshot~ an update time parameter if you aren’t externally clocking it.

line doesn’t take lists like line~ does.

But what I really don’t get is why you are not just staying in the MSP domain. What is the advantage to moving back to the event domain?

#217362
Dec 2, 2011 at 2:47am

@Peter: That’s an interesting solution that I’ll have to study.

@Chris: This is not so much about trying to accomplish anything specific but rather more of a “I can’t remember the name of that *insert person/movie/song* and it’s driving me crazy!” kind of situation (if that makes any sense). I have been drilling myself over the past couple of months by seeing if I can spontaneously patch simple operations on the fly, just to make sure I’ve got basics concepts down, and this was such an exercise.

I *swear* I found a simple solution for this around the end of summer but I’ve since lost it. Are you guys sure there is no (non-third party) way to simply get the line format list out of function and straight to a flonum?

And to actually answer your question Chris the only reason that I was going back to the event domain is that the clunky additive engine I built was based on a flonum sending to multiplier objects to create the partials.

If it’s not possible then I will have to chalk this up to me starting to get old and I must have been using [line] with a message (but I swear function was involved!).

#217363
Dec 2, 2011 at 4:03am

Doesn’t the patch you posted work if you change [snapshot~] to [snapshot~ 1] ?

#217364
Dec 2, 2011 at 5:05am

I had set the interval from the inspector before I copied it and posted it instead of adding the attribute, which was an oversight on my part. But no, I was getting the same results.

I changed the range of the scale object so you can hear what I’m talking about. You don’t get a smooth glissando with snapshot~. I know I was getting a smooth ramp with my previous solution (that I can’t remember).

– Pasted Max Patch, click to expand. –
#217365
Dec 2, 2011 at 6:21am

I'm afraid I can't help you with the function object but you can try this if you want:

[attachment=178111,3008]

Attachments:
  1. envelope.png
#217366
Dec 2, 2011 at 2:16pm

Thanks, I’ve got that solution somewhere on the HD. This was really about a very specific solution that I just can’t seem to remember.

#217367
Dec 2, 2011 at 2:34pm

I guess this must have been how I did it (and I stayed in the MSP domain, Chris). It just seemed simpler at the time. Sorry for imposing my madness on everyone.

– Pasted Max Patch, click to expand. –
#217368
Dec 2, 2011 at 6:07pm

I’m glad you found it. I didn’t think that you were going to find a better solution than the snapshot~ one is you were converting back to the event domain.

My last question is why do you have the fundamental there twice? The two left oscillators are at the same frequency.

#217369
Dec 3, 2011 at 12:26am

Ha, yes, well the answer to that is that it’s a mistake! Like I said before, I’m working on being able to quickly patch particular functions on the fly to test myself. I guess that was the Max equivalent of a typo. :-)

#217370
Dec 3, 2011 at 12:34am

i agree, you should stay in the frequency domain, then you can just use line~.

when you do you might find out that there is an mtof in your synth
after the note input – you will have to put that into the signal domain
too now when using glide data/signal, for example by using mtof~.

-110

#217371
Dec 3, 2011 at 12:41am

btw:

[attachment=178207,3012]

Attachments:
  1. eeen.jpg
#217372

You must be logged in to reply to this topic.