Bug 135986 - wrong normalization in RealtimeAnalyser.cpp
Summary: wrong normalization in RealtimeAnalyser.cpp
Status: RESOLVED DUPLICATE of bug 136120
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: In order to understand the idiotic di...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-15 11:09 PDT by wothke
Modified: 2014-08-20 17:54 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wothke 2014-08-15 11:09:53 PDT
In order to understand the idiotic differences between the data ranges of the AnalyzerNode's getFloatFrequencyData() and getByteFrequencyData() APIs I finally found myself analyzing the WebKit sources: https://github.com/WebKit/webkit/blob/master/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp

What surprises me there is the:
    const double magnitudeScale = 1.0 / DefaultFFTSize;
which is used to normalize the FFT results (see RealtimeAnalyser::doFFTAnalysis()).

I am not an expert on FFT but I think the correct scaling factor rather be: 2/actualFftSize

Also it seems that the respective code has actually been fixed in Chromium! see chromium\src\third_party\WebKit\Source\modules\webaudio
Comment 1 Alexey Proskuryakov 2014-08-20 17:54:04 PDT

*** This bug has been marked as a duplicate of bug 136120 ***