Oscillator [square] suffer from severe alias

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

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?

~
André Michelle
http://www.audiotool.com

Received on Monday, 6 March 2017 10:24:13 UTC