[sdiy] Wave terrain synthesis (was Re: Generating acyclicwaveforms?)
cheater cheater
cheater00 at gmail.com
Thu Mar 25 02:11:31 CET 2010
Hi Joel,
On Thu, Mar 25, 2010 at 00:16, Joel B <onephatcat at earthlink.net> wrote:
> I would be interested to see this math implemented in piece of C code so
> those of us who know how to use math in software development but don't have
> the background to understand that notation could try to figure out what you
> are describing in real terms - a mathematical description of a car engine
> won't necessarily look like an engine to a mechanic...
good idea, here we go, some pseudocode. Mind that in some specific
situations the discrete-time approximation will work differently than
the original continuous-time model, but for most intents and purposes
it should work.
let's assume that v[0] is the x-coordinate of vector v and v[1] is the
y-coordinate.
let's assume when writing v = (1, 2) the parentheses signify the
literal for a tuple, in this case a 2-tuple so a pair.
curve1(phi) {
//takes parameter 0 =< phi < 1 and returns a position on the plane.
//this is our C_1 in the previous post.
//we somehow generate the position and then return it:
position = (x, y)
return position
}
//now curve1(phi)[0] is the same as our C_1,x(phi) and curve1(phi)[1]
is the same as our C_1,y(phi) in our previous notation.
terrain(x, y) {
//takes float parameters x, y and returns the height of terrain at that point.
//we somehow generate the height at point x,y and then return it
return height
}
Now let's take something like dLdt = (0.000002, 0.000003). This is our
discrete version of dL/dt in the previous post, i.e. the change over
time of how far the curve C_1 was translated to C_2. So we have C_2,
and at t = 100 it's somewhere, and at t=200 it's translated somewhere
else, and inbetween those times it's geographically inbetween. How
this position changes over time is our dL/dt.
Define t is the time since the start of our simulation in samples.
curve2(phi, t) {
//the definition of the curve changes
//over time, that's why it needs t as an argument.
//the curve C_2 starts out the same as the curve C_1 but over
//time it slowly shifts to the right and up.
originalPosition = curve1(phi)
totalTranslation = dLdt * t
newPosition = originalPosition + totalTranslation
return newPosition
}
now let's define how the phase of our curve looks. Let's define it for
constant frequency for now:
phase(t) {
//generates a saw up from 0 to 1 with the cycle length of 1000 samples.
modt = t % 1000
return modt * 0.001
}
now let's look at how the synthesis works. You load some terrain
function and some curve.
Then your curve is scanned over time like this:
position = curve1(phase(t))
And your terrain is scanned over time like this:
value = terrain(curve1(phase(t)))
This is the output value of your scanned synthesis module, i.e. the audio.
Now if your curve is moving you could have something like this:
value = terrain(curve2(phase(t), t))
What effect the shifting that happens inside curve2 will have on the
sound depends on the shape of C_2 as defined by curve2.
To illustrate take this special example:
dLdT = (0.000001, 0) //this means that curve2 will be drifting to the right
and define curve1() like this:
curve1(phi) {
position = (0, 2*phi) //this means that curve1 is a line segment
that starts at the origin and ends at (0, 2)
return position
}
Now curve2(phi, t) signifies a vertical line segment which gets
modulated by being shifted to the right. This is exactly the same as
modulating the index in WT synthesis.
Now let's look at a different situation.
curve1() is defined the same, but dLdt = (0, 0.1)
In this case curve2() signifies a vertical straight line segment that
is moving upwards.
Now analyze what happens here:
output = terrain(curve2(phi(t), t))
If you analyze the situation, you will notice that the 'cursor' that
sweeps the curve (signified by phi(t)) will traverse the terrain
faster than with a stationary line segment. This means that the pitch
will be higher.
So what happens is that the terrain is being scanned upwards in
cycles, and every 1000 samples the cycle resets (because of how we
have defined phi()). Because the line segment itself is slowly moving
upwards, the speed of the scan is faster, and every 1000 cycles the
scan starts a little bit higher - to be exact, 100 units higher,
because that's the significance of 1000*dLdt. Because of this, we are
sort of changing the wavetable index too. Or maybe it's closer to this
situation: in samplers you can have a loop segment, and sometimes you
can modulate the loop position. This is what's happening here. The
function terrain() can be specifically constructed in a periodic
manner so that this vertical movement of the curve only changes the
pitch of the sound being output. For this to happen, if the curve is a
vertical line segment from (0,0) to (0, 2), then the terrain has to
repeat every time you go up 2 units:
terrain(x, y) == terrain(x, y+2)
The above two situations (vertical and horizontal movement) are the
two extremes, and for example situations inbetween are intermediate.
For example skew movement (dLdt = (0.1, 0.2) for example) gives a
pitch increase AND a sort of WT index.
For curves of non-zero curvature, i.e. 'not straight lines', when they
are being moved, you will have some of the first and some of the
second effect, depending on how parallel the curve segment is to the
vector the curve is being moved by, i.e. the dot product between dLdt
and the tangent vector to the curve C_1 at the point curve1(phi(t)).
Can we call this 10 paragraphs? :-) Hope this answers some questions.
On Wed, Mar 24, 2010 at 23:29, Ian Fritz <ijfritz at comcast.net> wrote:
> I can assure you I have forgotten more algebraic geometry than you will ever
> learn.
That's a brave thing for a, what are you teaching again, to say to a
mathematician.
> All he is saying is that if you are taking a path through some terrain and
> you speed up (staying on the path) you will get to the end sooner, so the
> corresponding wave frequency will be higher, and if you deviate slightly
> from the path, your time will be about the same but you will be going along
> a different path so the timbre will change.
>
No, this is incorrect, and not what I said. For one thing this
statement does not work when your path is a straight line segment and
you are translating the line segment by a vector parallel to it, at a
speed similar to the speed at which you are sweeping the curve. During
that time the timbre will not change for some time, but the pitch
will. This is a simple situation but there's more to be had. For
someone with thousands publications you understand very little of that
'very simple stuff' that you say 'sophomores in college' are learning.
The below can be skipped by anyone who isn't interested in me telling
off Ian and Scott and carries no information related to the topic,
really, but since some accusations happened here I feel it is my duty
to defend myself in the same place.
_________________________
> It doesn't matter a bit what publishing program you are using.
It does. LaTeX is the one and only markup language used in
professional scientific whitepapers that use any significant amount of
mathematical notation
> Besides, wouldn't it be more usual to write
> it as c_1,x. You are differentiating c_1, not one.
C_1,x would be more usual but if I did not include braces then I would
have written:
(C_1,x(phi) + L_x, C_2,x(phi) + L_y)
which is a four-dimensional vector with the coordinates
C_1
x(phi) + L_x
C_2
x(phi) + L_y
which would have not worked out to be what I had meant. For someone
who prides himself to know so much more about mathematics than I, you
have weak mathematical imagination.
(this last x should have been an y in the original post, btw, and the
_2 should have been _1. I guess I got mixed up which index to
increment :-) )
In that case you use braces to specify what exactly is meant by the
markup. LaTeX is not 'some publishing program', it is the standard.
There is no other standard for this, there's just TeX and LaTeX.
> You did not
> define c with a pair of subscripts.
No, I have not. The additional subscript is a standard mathematical
notation for vector calculus. For a vector V in R^2, V_x is the first
coordinate and V_y is the second coordinate. I've learned that in high
school, and probably so have you.
> It is absolutely forbidden to do so in
> any serious mathematical work.
What is? You could either mean adding a new subscript is forbidden, or
you could mean using multiple subscripts is forbidden.
If you mean that adding a new subscript is forbidden, then you haven't
worked a lot with mathematical mechanics, where subscripts are often
used to signify the application of a transformation (such as a
derivative over a certain variable) to a vector. In that case you
write v'_x to signify the @v/@x, the partial derivative of v over x.
It is very usual to find a vector defined as v, then in the next line
of the discourse see a notation of v'_x used in an equation without
v'_x having been explicitly defined - because it's standard practice.
Then in the next line you'll see v''_x,y or v''_x,z or v'''_x,y,z or
even v''_z,x for special functions where the order of taking partial
derivatives matters. Mechanics are another college sophomore topic
that someone interested in accoustics like you cannot live without -
right?
If you mean that using multiple subscripts is forbidden, then your
analytic geometry knowledge is not as good as you advertise, because
then you'd know that in tensor calculus multiple subscripts and
superscripts are used, quite often alternating, like this: v^a_{b
c}^d_e^{f g} which is v with the superscript a, then subscript b and
c, then superscript d, then subscript e, then superscript f and g. If
you don't like this, you can thaw out Einstein's brain and argue with
it, because he came up with it.
> Hi Scott --
>
> Thanks for the note! Yeah, I put C-C on my filter-to-trash list after about
> three of his posts.
>
Nice. Glad to know I'm being insulted by someone that I can't even
speak back to and have a healthy argument with. I haven't been treated
like this for quite some time now! Good to remember this sort of thing
exists, as a contrast to all the people that don't feel that they are
better than me and can judge me and insult me without even having
dialogue with me.
> He's clearly a kid, possibly a sophmore in college if he is taking analytic
> geometry (read third semester calculus).
Bet again. Wrong on all counts.
This shouldn't have to be said, but: just because I suggest a book to
someone doesn't mean I am in the process of reading through it for the
first time.
And just BTW, I've learned analytic geometry on my own while in high
school, and had the course done in the first semester at uni, when I
was 17.. that was a long time ago now, wow.
Trigonometry and synthetic geometry were much more difficult, because
we had to solve problems without making drawings. To understand what I
mean, enjoy proving the central angle theorem in ascii, without any
drawing as reference:
http://en.wikipedia.org/wiki/File:Inscribed_angle_theorem.svg
Scott,
>>
>> [private reply]
>>
>> Thank you Ian, I don't have the level of knowledge that you do to be able
>> to
>> authoritatively make a statement like that,
Seems Ian doesn't, either.
>> but I know that
>> cheater-cheater is full of
>> crap most of the time.
Hey, good to know. If you want to spread stuff like this about me,
maybe take this to me first to give me a chance to somehow address any
sort of problems you might be having. You're welcome to send me email
anytime you want. If you want to make bad air around me and undermine
me in secret without actually coming to me first to try and understand
what my motives are, well, I can only call that dishonourable. In
fact, I don't remember having a confrontation with you, and what I
know of your FPGA synth I can only say I thought was pretty good - so
how did I earn this? Have I eaten your canary? Childish.
I'm even more surprised at Ian posting this to the public
conversation. Why should anyone here be interested in this? This is
obviously an attempt to undermine my person and has nothing to do with
the original topic. I thought you were an academic. Would you take
your personal problems with other people to discussion at a
conference? Because this is what this list is, it's for scientific and
technical conversation and sometimes socializing, not for your petty,
arrogant attempts at proving you're a better person than anyone else
in here, be it me or other people you've treated like this recently in
other threads. If you acted like this in lectures that I attend the
lecturer would go silent and the other attendees would ask you to
leave without them being specifically told to do so.
>> Another interesting note is that in private emails to cheater, I
>> discovered that for all
>> of his pontification, he hasn't produced anything of any significant
>> substance in the
>> field of electronic music technology.
Never said I have. Ever. I'm just a humble mathematician sticking to
the mode of logical discourse he was taught by some smart people in
that field that he respects. If that's pontification then I'm not
sorry to be pontified.
>> And I've always wondered about people who take on such a handle as
>> cheater-cheater.
Yep, they're all crooks. Might as well change my nick to something
that has "fool" in it, huh? Or maybe a letter of the greek alphabet,
"alpha", "beta", "gamma", "omega". Those don't know anything either,
right?
I'm really surprised at all this. I thought this was a forum for
technical discussion about music synthesis, but it seems that there's
some secret circle of mutual adoration thing going on here that I'm
not included in and that circle is suddenly used to evaluate people in
here. I'm not bemoaning I'm not part of the little clan; I just
thought that this list was not about measuring the size of your dick
by showing off what scientific title you have and how many
publications you've got your name on, in an expectancy that you can
give shit to anyone who *you think* has got a shorter one than you. I
also didn't think it was about putting people down and telling them
they're void of value. This community is small enough that it could
use every bit of friendliness and at least a little less petty angst.
Regards
D.
More information about the Synth-diy
mailing list