[Vorbis-dev] Window function (again)

Tuomo Latto djv at mbnet.fi
Sat Jun 4 09:16:45 PDT 2005


bender at doanstar.de wrote:
>>Well, there was this in the original post (the link you gave):
>>--- clip -->
>>If you substitute z=2(x+0.5)/n, you get
>>    f(x(z)) = sin(1/2*pi*sin^2(z*pi/2))
>><-- pilc ---
>>
>>So, z = (2x + 1) / n.
>>If we then substitute x = n/2 - x we get
>>z = (2(n/2 - x) + 1) / n = 1 - (2x - 1)/n
>>=> 1 - z = (2x - 1)/n
>>which seems wrong.
>>
>>But if we forget the second line and try n/2+x in the first line,
>>we get
>>z = (2(n/2 + x) + 1) / n = 1 + (2x + 1)/n
>>=> z - 1 = (2x + 1)/n
>>which seems wrong too, but if we applied the symmetry here
>>we get 1 - z = z - 1 = (2x + 1)/n, which looks about right.
 >
> sin^2(pi/2*pi*g(z)) + sin^2(pi/2*pi*g(1-z)) = 1
> 
> But where does the second pis come from?

Looks like a typo to me...


> The Vorbis window function: f(x) = sin(pi/2 * sin^2(pi * (x + 0.5) / n))
> For easier calculations we could substitute 2*(x + 0.5) / n with z and 
> then get:
> 
> f(z) = sin(pi/2 * sin^2(pi * z/2)
> 
> Furthermore, we substitute sin^2(pi * z/2) with w and then get:
> 
> f(w) = sin(pi/2 * w)
> which correspondends with Gesemanns result (I hope that my abbreviated 
> notation is right... ;-)))
> 
> "With
>      g(z):=sin^2(z*pi/2)
> you get
>      f(x(z)) = sin(1/2*pi*g(z))"
          ^^^^
Perhaps this should be g(z)?


> Okay, the condition of Princen-Bradley says:
> 
> f^2(x) + f^2(x + n/2) = 1
> 
> With f(w) being f(w) = sin(pi/2 * w), we then would get:
> 
> f^2(w) + f^2(w + n/2) = 1
> <=> sin^2(pi/2 * w) + sin^2(pi/2 * (w + n/2))
> 
> So, my result has not the second pi in each summand and additionally, I 
> cannot understand, why one could turn w(z) + n/2 or w(z) - n/2 (i.e. 
> w(z) = my short term "w") into w(1 - z). I know that w(1 -z) could be 
> written as 1 - w(z) and that's all for me :-(. The n/2 still annoys me...

You'll notice that n does not appear with z anywhere, it appears only with x.
I think my first first explanation was probably wrong.

I think the idea is that 0 <= x < n, where n is the window length.
The window 0..n (variable x) is mapped to -1..1 essentially by dividing
it with half the window length and then subtracting one.
(That 0.5 in the original formula is just for odd window lengths.
I think the idea is to truncate the result, like when casting a floating
point number to an integer in C.)

This thing gets really screwy to think about as the window function is
symmetric (at n/2 if we're thinking sample-wise or at 0 if we're thinking
about the interval as -1..1). Then all sorts of weird things can be done.

And naturally I assume Sebastian will tell us if I'm wrong..

-- 
Tuomo

... ... there are two ways of constructing a software design:  One way
     is to make it so simple that there are _obviously_ no deficiencies and
     the other way is to make it so complicated that there are no _obvious_
     deficiencies.          -- C.A.R. Hoare, ACM Turing Award Lecture, 1980



More information about the Vorbis-dev mailing list