Re: [Bug 21980] New: WaveTable is highly underspecified

On Fri, May 10, 2013 at 12:56 PM, <rbj@audioimagination.com> wrote:

>
> ---------------------------- Original Message ----------------------------
> Subject: Re: [Bug 21980] New: WaveTable is highly underspecified
> From: "Chris Rogers" <crogers@google.com>
> Date: Thu, May 9, 2013 5:41 pm
> To: rbj@audioimagination.com
> Cc: "public-audio@w3.org" <public-audio@w3.org>
> --------------------------------------------------------------------------
>
> > On Thu, May 9, 2013 at 1:56 PM, <rbj@audioimagination.com> wrote:
> >
> >>
> >>
> >>
> >> btw, i am curious about the cos(0.5 * omega) factors in SAWTOOTH and
> >> TRIANGLE. (and not in SQUARE). what is that factor for?
> >>
> > Not sure off the top of my head, I think it just turned out to be the way
> > the Fourier series worked out.
> >
> >
>
>
> well, i still don't see where that factor comes from.  if you check out
>
> http://en.wikipedia.org/wiki/Sawtooth_wave
>
> and
>
> http://en.wikipedia.org/wiki/Triangle_wave
>
>
>
> they seem to verify what i remember from my first exposure to Fourier
> series.
>
> the saw coefficients should be ( (-1)^n )*(-2/pi)/n  for all n>0.
>
>
>
> and the triangle coefs should be ( (-1)^((n-1)/2) )*(8/pi^2)/n^2  for odd
> n and 0 for even n.
>
> but omega is dependent on n, and there should be no other dependency.
>
>
>
> oh... i think i get it.  cos(0.5 * omega) = cos(pi * n) which is (-1)^n
> for integer n.  so it might be valid, but it seems to be a computationally
> inefficient way to toggle the sign bit.
>
>
>
> Chris, does this Java script code for note analysis exist somewhere?  i
> don't know how to write Java or Java script, but what i have seen of Java
> looks a lot like C at the low level.  if there is a place for this analysis
> code, i can do this in C and let someone else wrap it up in Java.
>
Hi Robert, I'm really happy to have somebody with good DSP chops look over
this system.

Just to give you an overview, the Web Audio API is an API/system for
JavaScript developers to use to write audio applications, using modular
building blocks.  JavaScript is the language used in the web browser (on
the client's local machine) and looks a lot like C.  I've had good success
taking a snippet of DSP code in C and converting it to JavaScript almost
directly.  It's really beyond the scope of this list to go into much more
detail than that, but there are many good resources to learn about it.

The C++ code we've been looking at is just (under the hood) implementation
code for this JavaScript API in one open-source project (WebKit).  The idea
of the specification document is to describe the API in enough detail that
anybody could write their own separate implementation.




>   it requires pitch tracking, interpolation for the wavetable samples, and
> phase alignment of adjacent wavetables.  the initial dumb version could
> have a wavetable for every millisecond or maybe every 2 ms.  and, with a
> quick FFT on it, each extracted wavetable would have a line spectrum
> associated with it, in case someone wants to knock off some harmonics (as
> well as for wavetable culling)
>
>
>
> then we can discuss different ideas behind culling redundant wavetables.
> there are some issues there, particularly when interpolating along other
> dimensions. culling should happen only when the array of wavetables in
> *all* dimensions are being looked at.  and adjacent wavetables should be
> phase aligned in all dimensions, not just the slowtime dimension.  that
> spinning of wavetables (to align them) should happen before culling.  to
> within reasonable limits, there is not a time constraint on this analysis
> and wavetable extraction, because it is not real time.  but you don't want
> to have to take a long coffee break during the analysis either.
>
>
>
> L8r,
>
>
>
> r b-j
>
>
>
>
>

Received on Monday, 13 May 2013 16:49:42 UTC