## Archimedean spiral with gen~

Feb 17, 2013 at 8:10am

# Archimedean spiral with gen~

heya,

I’ve been trying to wrap my head around gen~, and so far have had little success. Can someone post a gen~ patch that would create an Archimedean spiral in the audio signal realm? I have a feeling once I see how a basic expression like this is done in gen~, I’ll be able to move on to more elaborate ones. Thanks!

r(theta) = a+btheta

#66561
Feb 17, 2013 at 1:44pm

If you can’t come to terms with gen~ in the time you have, poltocar~ is your friend (again!) Bit rough but should give you the idea. (And I still haven’t really grappled with gen~…yet…)

– Pasted Max Patch, click to expand. –
#239561
Feb 17, 2013 at 7:17pm

Thanks, spectro. I know how to use the cartopol~ and poltocar~ objects somewhat, but I really want to get into using gen~ for doing complex expressions on audio signals, hence the request to learn from the gurus.

#239562
Feb 18, 2013 at 6:50pm

Well you can duplicate what spectro posted inside of gen~ for similar results.

Whether the gen~ way is more efficient I do not know.

– Pasted Max Patch, click to expand. –

But I suspect you’re wanting to understand how to do this within an expr operator inside of gen~, is that right?

#239563
Feb 18, 2013 at 7:01pm

Hi stringtapper,

Thanks, but yes you are right, my goal is to learn how to do complex math expressions inside of gen~, not just cabling a few math operators together. I am hoping someone will be able to demonstrate how to write this basic equation/expression with genExpr code. :)

#239564
Feb 18, 2013 at 7:09pm

Can I ask if you know how to write the equation in the Max [expr] object (you seemed to indicate you might in your other thread)? If so I don’t think it’s going to be a lot different to do it in gen~’s expr operator, besides the obvious difference that it is operating on an audio signal.

#239565
Feb 18, 2013 at 7:15pm

haha, that’s the rub. I don’t. I guess I am trying to learn gen expressions because I need everything to be done at signal rate, but I also need help with writing expressions in Max in general.

#239566
Feb 18, 2013 at 7:45pm

Ha ok, then we are in the same boat. So it’s really about the issue of translating mathematical equations into code. For me the trouble starts with figuring out how to translate “theta” into something that the expr object recognizes. Understanding what “theta” even is in this context may be the real crux. That’s a mathematical deficiency on my part.

Sorry I’m not helping to answer, but maybe I can help better define the question so we may both get an answer. :-)

Now as far as there being a difference between connecting math operators together and simply using the expr operator in gen~ I am fairly certain it is explained in the Gen overview that there is no computational difference.

#239567
Feb 18, 2013 at 8:00pm

the eventual goal: computing highly complex mathematical expressions on audio signals. I asked about creating an Archimedean spiral because it is a simple equation. If I’m not mistaken, In polar coordinates, theta represents the degree or angular coordinate. The r represents the amplitude, radius, or distance from the origin. The a variable should rotate the spiral (phase?) and b should affect the tightness of the spiral.

r*theta = a + b*theta

#239568
Feb 18, 2013 at 8:23pm

I’m sure you are right, Gregory. I have no idea how complex I will eventually go, but for now, my interest may be more academic than practical.

#239570
Feb 19, 2013 at 2:53pm

I’ve never used codebox but it turns out it’s very very easy! 5 mins with the GenExpr help doc and I got this:

– Pasted Max Patch, click to expand. –
#239573
Feb 19, 2013 at 3:03pm

and here’s Graham’s last example (sexy BTW) CodeBoxed.

– Pasted Max Patch, click to expand. –
#239574
Feb 21, 2013 at 9:42am

thanks Graham and leafcutter. I haven’t had time to really dig in to your patches, but I will soon…

#239575
Feb 21, 2013 at 12:07pm

@leafcutter: and instead of the actual values, it is possible to write twopi and pi.

#239576
Feb 21, 2013 at 12:11pm

jvkr – I think we both did use pi?

#239577
Feb 21, 2013 at 12:17pm

When I open your before last patch it says this:

sigA = in1 * 50 – 25;
sigB = in2 * 6.28318 – 3.14159;
out1, out2 = poltocar (sigA, sigB);

And indeed, that latter uses pi—didn’t see that :)

#239578

You must be logged in to reply to this topic.