RESOLVED INVALID 105912
Biquad filter: The phase response is incorrect
https://bugs.webkit.org/show_bug.cgi?id=105912
Summary Biquad filter: The phase response is incorrect
kdj
Reported 2013-01-02 03:04:56 PST
The phase change of frequency values is not happening as expected. Verified on Webkit-r137862. Please find the example below here: ---------------------------------------------------------------------------------------------------------- var duration = 2.0; var sampleRate = 44100.0; function { context = window.AudioContext; numberOfFrames = duration * sampleRate; filter = context.createBiquadFilter(); source = context.createBufferSource(); ...... fre = new Float32Array(numberOfFrames); mag = new Float32Array(numberOfFrames); pha = new Float32Array(numberOfFrames); ...... buffer = context.createBuffer(1,numberOfFrames, sampleRate); data = buffer.getChannelData(0); ...... // data filled with random values // for e.g. data[i] = Math.sin(440.0 * Math.PI * i / sampleRate); ...... source.buffer = buffer; filter.type = 7; filter.frequency.value = 495.0; filter.getFrequencyResponse(fre, mag, pha); ....... source.connect(filter); filter.connect(context.destination); ....... } var result = (pha[numberOfFrames/2] != pha[(numberOfFrames/2) - 1]); assert_true(result, "Check if BiquadFilterNode.ALLPASS filter changes the phase relationship"); ---------------------------------------------------------------------------------------------------------- Expected behaviour: 'pha[numberOfFrames/2]' is not equal to 'pha[(numberOfFrames/2) - 1]' and result == true Current Result: The value of result is coming as False. Observed behaviour: pha[numberOfFrames/2] = pha[(numberOfFrames/2) - 1] = 0;
Attachments
Raymond Toy
Comment 1 2013-01-07 10:22:23 PST
In the example code given, there a mistake. The values of the fre array are not set so they're all initialized to 0. getFrequencyResponse returns the response for the frequency values in fre, so the mag and phase arrays are all filled with the same values corresponding to the response at frequency 0. Please submit a more complete example if this problem still occurs.
kdj
Comment 2 2013-02-01 01:54:11 PST
Thanks for notifying the error; Test case has the issue, so marking it as resolved and INVALID. (In reply to comment #1) > In the example code given, there a mistake. The values of the fre array are not set so they're all initialized to 0. getFrequencyResponse returns the response for the frequency values in fre, so the mag and phase arrays are all filled with the same values corresponding to the response at frequency 0. > > Please submit a more complete example if this problem still occurs.
Note You need to log in before you can comment on or make changes to this bug.