W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2017

Re: Oscillator [square] suffer from severe alias

From: Raymond Toy <rtoy@google.com>
Date: Mon, 6 Mar 2017 10:18:56 -0800
Message-ID: <CAE3TgXFz1NThpMX3xR5aRHgMOfCn72Rz2Nrmy9E-Noc8MQ-emw@mail.gmail.com>
To: André Michelle <andre.michelle@audiotool.com>
Cc: Audio Working Group <public-audio@w3.org>
This isn't really the right place for this since this mailing list is about
issues in the spec.
Perhaps public-audio-dev would be better.

Having said that, see comments below.

On Sat, Mar 4, 2017 at 1:27 AM, André Michelle <andre.michelle@audiotool.com
> wrote:

> Hi all,
>
>
> I am developing a bandlimited oscillator for our synthesiser in
> www.audiotool.com and could not get it quite right. I tested the
> web-audio-api as a reference and voila: There is alias as well.
> http://jsbin.com/xebozar/edit?js,output


Modulating should generate extra harmonics which probably should alias in.
(I'd have to do the analysis in the digital domain to understand what
really happens).

I assume that's not what you're complaining about.


>
> I downloaded the sources from here to reimplement it in Java to find the
> problem.
> https://github.com/WebKit/webkit/blob/master/Source/
> WebCore/Modules/webaudio/OscillatorNode.cpp
> https://github.com/WebKit/webkit/blob/master/Source/
> WebCore/Modules/webaudio/PeriodicWave.cpp
>
> My port produces the exact same amount of alias at the same frequencies.
> The code in "PeriodicWave::waveDataForFundamentalFrequency" obviously
> chooses a table with too much harmonics but I could not find a fix and an
> obvious error. I could however replace the look-up code for a test, that it
> always returns the tables with just a single harmonic (sine-wave) and the
> alias is gone. That means that the wavetable size is big enough and the
> linear interpolation is working well.
>
> Any thoughts on this?
>
>
Are you saying that the interpolation of the frequency ends up using a low
frequency table (with more components) and a higher frequency table (with
fewer components) so that the result has too many frequency components?

Now that you mention it, that does seem like a problem.  Can't think of how
to solve that though.
Received on Monday, 6 March 2017 18:19:29 UTC

This archive was generated by hypermail 2.3.1 : Monday, 6 March 2017 18:19:30 UTC