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
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...)
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.
Well you can duplicate what spectro posted inside of gen~ for similar results.
Whether the gen~ way is more efficient I do not know.
But I suspect you're wanting to understand how to do this within an expr operator inside of gen~, is that right?
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. :)
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.
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.
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.
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
"my goal is to learn how to do complex math expressions inside of gen~, not just cabling a few math operators together."
Unless you're doing something that branches like crazy or is a billion lines long, I doubt you're going to necessarily get a great deal of effciency by using the expr operator.
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.
I took a look at http://en.wikipedia.org/wiki/Archimedean_spiral
The polar function is arranged to produce r for a given theta. We need a way to sample this function, e.g. generate a ramp of thetas from the output of a [phasor]. Converting r and theta to x and y just needs a [poltocar].
For the broader goal, also check out some of the chaotic oscillator examples in the gen examples folder for more ideas.
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:
and here's Graham's last example (sexy BTW) CodeBoxed.
thanks Graham and leafcutter. I haven't had time to really dig in to your patches, but I will soon...
@leafcutter: and instead of the actual values, it is possible to write twopi and pi.
jvkr - I think we both did use pi?
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 :)