Charles Henry czhenry at gmail.com
Mon Dec 24 01:59:49 CET 2007

```On Dec 23, 2007 12:50 PM, Mathieu Bouchard <matju at artengine.ca> wrote:
> Functions with constant total energy are a convex space. This is like a
> linear space except it changes one rule: in a vector space, if a,b are
> scalars and x,y are vectors, then ax+by is a vector. In a convex space,
> there's the additional restrictions that a+b=1 and a>=0 and b>=0, so that
> you can only blend vectors together by various ponderations, without
> adding any gain. In 2-dimensional space, any base of a convex space
> generates a convex polygon (polyhedron if 3-dimensional space instead).

To split hairs, we want to constrain the total energy in mixing
signals, which means we have to expand the inner product.  This
ensures that we have a solid homotopy, where we're not interpolating
outside of our space (I stated this wrongly in the first place!).  It
also shows that any two signals in the space are connected by a
continuous function, with no additional definitions.

so, |x|^2=|y|^2=1
and |a*x+b*y|^2=a^2*|x|^2+b^2*|y|^2+a*b*<x,y>=1
a^2*|x|^2+a*b*<x,y>+(b^2*|y|^2-1)=0
(quadratic formula to split things up)

a=-b*<x,y>/(2*|x|^2) +/- sqrt( (b*<x,y>)^2-4*|x|^2*(b^2*|y|^2-1))/(2*|x|^2)
simplifies to
a=-b*<x,y>/2 +/- sqrt( (b*<x,y>)^2-4*(b^2-1) )/2
and we want good numbers out of this, so we'll take an additional step
to show that we have a smooth curve (no complex numbers in our mixing
function) and we want a and b >=0

(is it the triangle inequality?--side note: why doesn't the triangle
inequality get attributed to someone? ahhh here it is.  The Triangle
inequality is named for British mathematician Arthur Triangle
(bullshit :P)
0 <= <x,y>^2 <= |x|*|y| :=1

we let b be in [0,1] and a(b) will be a function of b
0<=b<=b^2<=1
b^2*<x,y>^2-4*(b^2-1)=b^2*(2*<x,y>^2-4)+4
then,
-4 <= 2*<x,y>^2-4
-4 <= -4*b^2 <= (2*<x,y>^2-4)*b^2
0 <= (2*<x,y>^2-4)*b^2 + 4
No complex numbers!  Next, we require that a > 0, so we will throw
away one solution from our quadratic equation, and see if the result
is positive!

a(b)=-b*<x,y>/2 + sqrt( (b*<x,y>)^2-4*(b^2-1) )/2
and we have to make an inequality
0<=-b*<x,y>/2 + sqrt( (b*<x,y>)^2-4*(b^2-1) )/2
b*<x,y>/2 <= sqrt( (b*<x,y>)^2-4*(b^2-1) )/2

b^2*<x,y>^2/4 <= ((b*<x,y>)^2-4*(b^2-1))/4  (which we want to prove to
show that a is positive)
turns out to be easy
b^2*<x,y>^2 <= (b*<x,y>)^2-4*(b^2-1)
b^2*<x,y>^2 <= (b*<x,y>)^2-4*b^2 + 4
0 <= -4*b^2 + 4
4*b^2 <= 4  True!

so, the correct thing to do is take b on [0,1] and
a(b)=-b*<x,y>/2 + sqrt( (b*<x,y>)^2-4*(b^2-1) )/2
easy to check that a(0)=1 and a(1)=0 , no matter what <x,y> is

(another side note: suppose y = -x and <x,y> = -1
Then, for b on [0,1]
a=b/2+sqrt( -3*b^2+4) )/2
b=0 -> a=1  and b=1 -> a=0
b=0.25 -> a=1.1  ???  I'm still doing something wrong apparently!  but
I'm not erasing it!  It's too late!!!  What did I do?

> >> If you are using the affine space, you can't simply add and you can't
> >> simply multiply by a scalar: instead, the fundamental operation is the
> >> convex sum of "vectors": as a single operation, you add together any
> >> number of vectors, weighted, where the total weight has to be 1, so that
> >> the amplitude of the fundamental sticks to 1.
> > This makes good sense to me.  The operators on this space are still a
> > little fuzzy, though.

I've always been fascinated (obsessed maybe? meh) with convolution
operators.  I have often said some wrong things about these, but later
worked out proofs of general properties that are essential.
L1 norms and L2 norms are the most important.  Convolution preserves
L1 norms (proof on request) in the following way
(here | . | represents the L1 norm, |f| = integral( -inf, inf,  |f|dt)
and * is convolution

|x*y| = |x| |y|

and in the L2 norm shown here with same notation
|f| = sqrt( integral( -inf, inf, f^2dt) )

|x*y| <= sqrt( |x| |y| )

To me, convolution makes a good operator for consideration in this
type of space.  Maybe there's a modification to the definition we can
make to be sure that |x*y|^2=1 ?

> Actually, note the difference with convex space: in an affine space, you
> are not restricted to a>=0 and b>=0. I can only call the latter a convex
> sum because energy is nonnegative. (Btw, are the values in the vector
> supposed to be energy values or amplitude values?)

The values in the vector should be amplitudes of orthogonal components, right?

> > suppose f(t) is a complex tone with frequencies of 100, 200, 300, 400,
> > 500 and g(t) has frequencies of 100, 200, 330, 400, 500 Then, when we
> > mix the two tones together there is dissonance between the frequencies
> > of 300 and 330, which wasn't present in either of the two tones.
>
> Dissonance is a somewhat complicated operation, imho. How you compute it?
> It's definitely non-linear. It could be a quadratic form, perhaps. Think
> of it as a matrix sandwiched between twice the same vector so that the
> result is a scalar. e.g. diss(x) = x'*A*x, where apostrophe means
> transpose. What would be a good A ?

Dissonance arises from narrow-band tones close together.  Chuckk
Hubbard posted the dissonance function a while back, on the list in a
pd patch.
I expanded on Chuckk's function to make the typical dissonance curves
you see (like Partch's one-footed bride) by using the exact approach
you've just mentioned, but I didn't do it so elegantly.
X has a set of frequencies f1, f2, etc... with amplitudes a1,a2, etc...

Then, dissonance arises between pairs of frequencies by a nonlinear
function N(X) which takes the dissonance between each pair and creates
a vector of all possibilities.
diss(X)=N(X)*A*N(x)/2
where A=
[0       a1*a2 a1*a3 a1*a4 ....
[a1*a2 0       a2*a3 a2*a4 .....
[a1*a3 a2*a3 0       a3*a4 .....
.
.
.
where you see a1*a2, etc... I mean for it to be sqrt(a1*a2)

The elements are on the diagonal are zero because a single frequency
makes no dissonance with itself.

However, I have not seen a single study that actually will say *how*
dissonances add together!  AFAIK there is no data on it!

> Forget the matrix syntax, because this vector space is R^R... but matrix
> ideas can be mapped to functions. What's the dissonance function A(i,j)
> for two frequencies i,j? Or maybe A(i,j,w) where w is the window size that
> the dissonance is relative to. I guess that there are many valid and
> useful dissonance functions, depending on taste.
>
>    diss(x) = integral of integral of A(i,j)*x(i)*x(j) di dj
>
> > By infinity, I mean, can we take a harmonic complex tone and change the
> > amplitudes of the partials, to achieve any given sharpness/dullness of
> > the tone?  Essentially being able to increase the central moment of
> > spectral denisty without bound.
>
> This looks like a job for equalisers... but it requires a signal
> that has infinitely many partials.
>
> > Bounded in terms of the dimensions of timbre.  For example, dissonance.
> > Can we have a tone which is maximally dissonant?  Are there boundaries
> > on the other dimensions of timbre?
>
> Apart from A(i,j)=A(j,i) and A(i,i)=0, I don't have much knowledge of what
> would make a good dissonance function. I can't tell what's maximally
> dissonant without having a dissonance function first.

Plus, there's the added complication of non-linear critical band rate.
So, the dissonance function is different for different registers
(like the difference between a major third harmony in bass as opposed
to treble).  It is complicated.
Attached is my resurrected/re-designed dissonance curves patch.  The
last thing I was doing with it was to look at dissonace relations with
odd-harmonic series.  Yes, it's very crudely coded--see for
yourself--if anyone wants to collaborate, I'm up for a fundamental
overhaul.

Chuck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dissonance_curves_mod2.pd
Type: application/octet-stream
Size: 40655 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20071223/44d764e6/attachment.obj>
```