WebAudio: limit output level to 0db
<rdar://problem/11966135>
Created attachment 162124 [details] Patch
Created attachment 162125 [details] Patch Set frequency of test to within the average human hearing range.
Comment on attachment 162125 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=162125&action=review > Source/WebCore/ChangeLog:4 > + WebAudio: limit output level to 0db > + https://bugs.webkit.org/show_bug.cgi?id=95792 Could you please add Radar link here, too? It's always a good idea to have these readily accessible.
Created attachment 162273 [details] Patch Sure thing. Also added a couple of missing ASSERTS to AudioDestinationMac::configure()
Hi Jer, I highly recommend against using AUPeakLimiter in this case. It's more of a mastering effect and will "touch" the audio signal in ways that would be undesirable. It also has a processing latency. Instead, I recommend looking at AudioDestinationMac::render() after this call: m_callback.render(0, &m_renderBus, numberOfFrames); I would simply go through each AudioChannel of m_renderBus and "clamp" all the PCM data to be within the range -1 -> +1
Created attachment 168771 [details] Patch
Comment on attachment 168771 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=168771&action=review Looks fine to me with some small nits. > Source/WebCore/ChangeLog:12 > + >0db buffers and effects. I'd update the ChangeLog comment here > Source/WebCore/platform/audio/VectorMath.cpp:115 > +void vclip(const float * sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess) style nit: "float *" -> "float*" > Source/WebCore/platform/audio/VectorMath.cpp:651 > +void vclip(const float * sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess) style nit: "float *" -> "float*" > Source/WebCore/platform/audio/VectorMath.h:53 > +void vclip(const float * sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess); style nit: "float *" -> "float*" > ManualTests/webaudio/limit-level-0db.html:36 > + </p> Maybe update comment - Strictly speaking, you'll hear the "clipping", thus the sine wave will be clipped into the form of a square wave, but it shouldn't get radically louder than the full-scale sine wave
Committed r131459: <http://trac.webkit.org/changeset/131459>