Oscillator suffers from severe alias
Reported by
andre.mi...@gmail.com,
Mar 7 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Steps to reproduce the problem: 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. What is the expected behavior? No alias should be audible in higher frequencies What went wrong? A wavetable has been chosen from the oscillator implementation that contains frequencies that are higher than the nyquist frequency. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 56.0.2924.87 Channel: stable OS Version: OS X 10.12.3 Flash Version: Shockwave Flash 24.0 r0
,
Mar 8 2017
Could you explain more clearly on what you did in the test to fix the aliasing? It is pretty clear that for a fixed frequency, the oscillator implementation is not band-limited if the frequency lies between the frequencies in the table. One entry possibly has too many frequencies and the other has too few. Not sure how to fix that in an efficient manner. I have to do some more investigation, but it's not really clear how much of the aliasing you hear is due to the frequency modulation in the demo. Frequency modulation must generate additional frequency components and I think these are getting aliased in and that is what you hear. To really hear the warbling, replace the exponential ramp with a linear ramp.
,
Mar 8 2017
I did not fix it. No. You usually do not use any table with frequencies that has too many harmonics. You can use a static (high) frequency as well to hear the alias. The modulation is not fast enough to produce side bands as in FM or PM. ~ André Michelle
,
Mar 8 2017
It seems to me that your second sentence ("do not use any table...") is inconsistent with the third sentence ("static frequency ... to hear the alias").
If you do hear the alias with a static frequency, can you tell me what frequency you used and the sample rate of the AudioContext? I want to be able to reproduce this locally so I can investigate why the oscillator produces aliasing.
,
Mar 10 2017
I did an experiment using matlab/octave using a modulated pure sin. I basically did sin(2*pi*f*t) where f is the exponential ramp from 20 to 20000 over a 10 sec interval, as down in the fiddle. I set the sample rate to 48kHz. I listened to the output. I get a nice increasing frequency until around 5-8 sec and then there is distinct warbling. As a further experiment, I did the same thing except set the sample rate to 48000*16 Hz (16-times oversampling from before). This was intended to capture some (if any) harmonics generated by the modulation. Then, I decimated this signal by a factor of 16 WITHOUT applying any filtering (as is usually done when decimating) to make sure any harmonics are aliased back in. And listened to this result again. It sounds basically the same as the first experiment. Here's the matlab/octave code: t = linspace(0, 10, 48000*10); f = 20*(20000/20).^(t/10); x = sin(2*pi*f.*t); wavwrite(x, 48000, 'test.wav'); Listen. For the second experiment: t = linspace(0, 10, 48000*10*16); f = 20*(20000/20).^(t/10); x = sin(2*pi*f.*t); xdec = x(1:16:size(x)); wavwrite(xdec, 48000, 'test.wav'); Based on these experiments, the oscillator is working as intended. The modulation causes harmonics that can't be filtered out and are correctly aliased back into the output signal.
,
Mar 15 2017
,
Apr 17 2017
Closing as WontFix (WAI). If this is incorrect, please reopen or file a new bug. Thanks for the report. |
|||
►
Sign in to add a comment |
|||
Comment 1 by rtoy@chromium.org
, Mar 7 2017