This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17394 - (SamplingFormat): Define sampling format
Summary: (SamplingFormat): Define sampling format
Status: CLOSED WONTFIX
Alias: None
Product: AudioWG
Classification: Unclassified
Component: Web Audio API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: TBD
Assignee: Chris Rogers
QA Contact: This bug has no owner yet - up for the taking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-05 12:14 UTC by Michael[tm] Smith
Modified: 2014-10-28 17:17 UTC (History)
3 users (show)

See Also:


Attachments

Description Michael[tm] Smith 2012-06-05 12:14:04 UTC
Audio-ISSUE-19 (SamplingFormat): Define sampling format [Web Audio API]

http://www.w3.org/2011/audio/track/issues/19

Raised by: Marcus Geelnard
On product: Web Audio API

In the internal sample format the interpretation of Float32 NaN, +-Inf etc is not defined. More generally, it seems to not be defined what the sampling format of everything is (AudioBuffer, WaveShaperNode, etc).
Comment 1 Olivier Thereaux 2012-06-07 08:17:20 UTC
[admin] Assigning items currently being worked on by editor.
Comment 2 Olivier Thereaux 2012-06-07 14:24:48 UTC
Changeset from the editor: https://dvcs.w3.org/hg/audio/rev/b4680b4ee21d


Comment from Philip in http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0434.html
«
The definition of float should be left to WebIDL:  
http://www.w3.org/TR/WebIDL/#idl-float

What we wanted to know is how to interpret NaN and Infinity when passing  
the data on to the actual hardware. The best way to spec this might be as  
a clamping step in AudioDestinationNode, to say that NaN is interpreted as  
0 and all other values are clamped to the [-1, 1] range. In other words,  
Infinity becomes 1 and -Infinity -1, such that it is well defined how a  
JavaScript generating a square wave oscillating between infinities will  
sound.

We think that there will be inconsistencies between implementations in how  
NaN values in the input of the various nodes affect the output, since it  
depends a lot on the implementation technique. We're not going to suggest  
defining that exactly at this point, but we may have reason to re-visit it  
when implementing.
»


Comment from Ray in http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0436.html
«
It seems that once a NaN or infinity has been generated, something
seriously wrong is going on and should be fixed there.  Having to check for
NaN or infinity on the input of every node seems like a lot of overhead for
a situation that should not occur at all.  This excludes your example of a
JavaScript node generating infinities on purpose.  I don't understand why
you would want to do that in practice.
»

Comment from Philip in http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0443.html
«
Of course script should not intentionally generate NaN or infinities, but  
like with all Web-facing APIs we can be 100% certain that people will  
accidentally do it. WebKit must already do *something* in this situation,  
so we can just spec that if it makes sense. With offline audio contexts,  
the result will be script-visible and a complete test suite must cover  
this case.
»
Comment 3 Chris Rogers 2012-10-16 20:34:15 UTC
(In reply to comment #2)
> Changeset from the editor: https://dvcs.w3.org/hg/audio/rev/b4680b4ee21d
> 
> 
> Comment from Philip in
> http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0434.html
> «
> The definition of float should be left to WebIDL:  
> http://www.w3.org/TR/WebIDL/#idl-float
> 
> What we wanted to know is how to interpret NaN and Infinity when passing  
> the data on to the actual hardware. The best way to spec this might be as  
> a clamping step in AudioDestinationNode, to say that NaN is interpreted as  
> 0 and all other values are clamped to the [-1, 1] range. In other words,  
> Infinity becomes 1 and -Infinity -1, such that it is well defined how a  
> JavaScript generating a square wave oscillating between infinities will  
> sound.
> 
> We think that there will be inconsistencies between implementations in how  
> NaN values in the input of the various nodes affect the output, since it  
> depends a lot on the implementation technique. We're not going to suggest  
> defining that exactly at this point, but we may have reason to re-visit it  
> when implementing.
> »
> 
> 
> Comment from Ray in
> http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0436.html
> «
> It seems that once a NaN or infinity has been generated, something
> seriously wrong is going on and should be fixed there.  Having to check for
> NaN or infinity on the input of every node seems like a lot of overhead for
> a situation that should not occur at all.  This excludes your example of a
> JavaScript node generating infinities on purpose.  I don't understand why
> you would want to do that in practice.
> »
> 
> Comment from Philip in
> http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0443.html
> «
> Of course script should not intentionally generate NaN or infinities, but  
> like with all Web-facing APIs we can be 100% certain that people will  
> accidentally do it. WebKit must already do *something* in this situation,  
> so we can just spec that if it makes sense. With offline audio contexts,  
> the result will be script-visible and a complete test suite must cover  
> this case.
> »

Currently WebKit doesn't do anything to specially handle these values.  If we need to define/spec the behavior in the AudioDestinationNode, then I suggest that NaN and Inf both be converted to 0

If there's a strong feeling that this needs to be specified, then we can do that.  But, the reality is that these represent anomalous conditions and regardless of approach taken, the rendered audio will sound messed up.  So, my recommendation is to not fret about this.
Comment 4 Olivier Thereaux 2014-10-28 17:14:21 UTC
Web Audio API issues have been migrated to Github. 
See https://github.com/WebAudio/web-audio-api/issues
Comment 5 Olivier Thereaux 2014-10-28 17:17:13 UTC
Closing. See https://github.com/WebAudio/web-audio-api/issues for up to date list of issues for the Web Audio API.