<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>21223</bug_id>
          
          <creation_ts>2013-03-08 16:55:21 +0000</creation_ts>
          <short_desc>Mandate a useful accepted sampling rate ranges for buffers created through AudioContext.createBuffer</short_desc>
          <delta_ts>2014-10-28 17:17:39 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>AudioWG</product>
          <component>Web Audio API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>TBD</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ehsan Akhgari [:ehsan]">ehsan</reporter>
          <assigned_to name="Ehsan Akhgari [:ehsan]">ehsan</assigned_to>
          <cc>giles</cc>
    
    <cc>mtanalin</cc>
    
    <cc>olivier.thereaux</cc>
          
          <qa_contact>public-audio</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84120</commentid>
    <comment_count>0</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-08 16:55:21 +0000</bug_when>
    <thetext>Currently, the spec just suggests that implementations should at least accept sampling rate ranges of 22050-96000.  I think it would be better to mandate this range as opposed to just suggest it, since otherwise it would be possible to write code which works in one UA and not the other.

Also, sampling rates outside of this range probably don&apos;t make much sense anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84121</commentid>
    <comment_count>1</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-08 16:57:11 +0000</bug_when>
    <thetext>Paul Adenot brought up a very good point in &lt;https://bugzilla.mozilla.org/show_bug.cgi?id=849230#c1&gt;.  We should consider setting the minimum sample rate value to 8000Hz.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84122</commentid>
    <comment_count>2</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-08 16:59:45 +0000</bug_when>
    <thetext>Also, the spec doesn&apos;t specify what needs to happen if the sample rate is not accepted, as usual. ;)  WebKit throws DOM_SYNTAX_ERR, I&apos;m going to modify Gecko to do the same.  We should spec this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84134</commentid>
    <comment_count>3</comment_count>
    <who name="Ralph Giles">giles</who>
    <bug_when>2013-03-08 21:20:20 +0000</bug_when>
    <thetext>96 kHz is an odd limit, considering the fad for material at 192 kHz. I think the allowed range should be either 8-48 kHz or 8-192 kHz.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84135</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Rogers">crogers</who>
    <bug_when>2013-03-08 21:33:37 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; 96 kHz is an odd limit, considering the fad for material at 192 kHz. I think
&gt; the allowed range should be either 8-48 kHz or 8-192 kHz.

8-192 KHz sounds good to me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84137</commentid>
    <comment_count>5</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-08 21:39:09 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; 96 kHz is an odd limit, considering the fad for material at 192 kHz. I think
&gt; &gt; the allowed range should be either 8-48 kHz or 8-192 kHz.
&gt; 
&gt; 8-192 KHz sounds good to me

Sounds good to me too!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84200</commentid>
    <comment_count>6</comment_count>
    <who name="Marat Tanalin | tanalin.com">mtanalin</who>
    <bug_when>2013-03-10 16:37:32 +0000</bug_when>
    <thetext>&quot;At least&quot; should not be confused with &quot;limited to&quot;. These are totally different things.

Current spec says &quot;must&quot;, not &quot;should&quot;:

&quot;An implementation must support sample-rates in at least the range 22050 to 96000.&quot;
(https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#dfn-sampleRate_2)

That does require that the range of sample rates must be supported, but does not prevent implementations from supporting more wide range if they want / need / are able to.

There is no sense to _limit_ sample-rate range unless there are corresponding technical limitations in a specific implementation. This is completely out of the spec scope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84220</commentid>
    <comment_count>7</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2013-03-11 11:43:28 +0000</bug_when>
    <thetext>The spec currently says two things:
* An implementation must support sample-rates in at least the range 22050 to 96000.
* An exception will be thrown if the numberOfChannels or sampleRate are out-of-bounds


Looking at the discussion so far, I think the spec should say something like:

* implementations MUST support sampling rate ranges of 8-192 KHz. sampling rates beyond this range MAY be supported.
* [in The createBuffer method ] An exception MUST be thrown if sampleRate is out of bounds.

is DOM_SYNTAX_ERR the best exception though?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84224</commentid>
    <comment_count>8</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-11 15:12:34 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; The spec currently says two things:
&gt; * An implementation must support sample-rates in at least the range 22050 to
&gt; 96000.
&gt; * An exception will be thrown if the numberOfChannels or sampleRate are
&gt; out-of-bounds
&gt; 
&gt; 
&gt; Looking at the discussion so far, I think the spec should say something like:
&gt; 
&gt; * implementations MUST support sampling rate ranges of 8-192 KHz. sampling
&gt; rates beyond this range MAY be supported.
&gt; * [in The createBuffer method ] An exception MUST be thrown if sampleRate is
&gt; out of bounds.

That sounds fine.

&gt; is DOM_SYNTAX_ERR the best exception though?

Not really.  The best exception for this kind of error would be INDEX_SIZE_ERR, I think, since that is supposed to be used for out of range arguments &lt;http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-17189187&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84337</commentid>
    <comment_count>9</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2013-03-13 14:50:31 +0000</bug_when>
    <thetext>Seeing as we seem to have consensus on the solution, I am setting the issue as ASSIGNED (to CRogers - although others are welcome to send a patch to the source of the spec in dvcs.w3.org).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84339</commentid>
    <comment_count>10</comment_count>
      <attachid>1336</attachid>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-13 15:07:04 +0000</bug_when>
    <thetext>Created attachment 1336
Patch

Does this look good?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84340</commentid>
    <comment_count>11</comment_count>
      <attachid>1337</attachid>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-13 15:08:44 +0000</bug_when>
    <thetext>Created attachment 1337
Patch

Actually this is probably better!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84426</commentid>
    <comment_count>12</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2013-03-14 16:45:19 +0000</bug_when>
    <thetext>(In reply to comment #11)
&gt; Created attachment 1337 [details]
&gt; Patch
&gt; 
&gt; Actually this is probably better!

Ehsan, we discussed this - good to go, please push to the repo.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113948</commentid>
    <comment_count>13</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2014-10-28 17:14:42 +0000</bug_when>
    <thetext>Web Audio API issues have been migrated to Github. 
See https://github.com/WebAudio/web-audio-api/issues</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114097</commentid>
    <comment_count>14</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2014-10-28 17:17:39 +0000</bug_when>
    <thetext>Closing. See https://github.com/WebAudio/web-audio-api/issues for up to date list of issues for the Web Audio API.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>1336</attachid>
            <date>2013-03-13 15:07:04 +0000</date>
            <delta_ts>2013-03-13 15:08:44 +0000</delta_ts>
            <desc>Patch</desc>
            <filename>x</filename>
            <type>text/plain</type>
            <size>1562</size>
            <attacher name="Ehsan Akhgari [:ehsan]">ehsan</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3dlYmF1ZGlvL3NwZWNpZmljYXRpb24uaHRtbCBiL3dlYmF1ZGlvL3NwZWNp
ZmljYXRpb24uaHRtbAotLS0gYS93ZWJhdWRpby9zcGVjaWZpY2F0aW9uLmh0bWwKKysrIGIvd2Vi
YXVkaW8vc3BlY2lmaWNhdGlvbi5odG1sCkBAIC05MTcsMTcgKzkxNywxOCBAQCBpbnRlcmZhY2Ug
PGRmbiBpZD0iZGZuLUF1ZGlvQ29udGV4dCI+QXVkCiAgICAgICBidWZmZXIgd2lsbCBiZSB6ZXJv
LWluaXRpYWxpemVkIChzaWxlbnQpLiAgQW4gZXhjZXB0aW9uIHdpbGwgYmUgdGhyb3duIGlmCiAg
ICAgICB0aGUgPGNvZGU+bnVtYmVyT2ZDaGFubmVsczwvY29kZT4gb3IgPGNvZGU+c2FtcGxlUmF0
ZTwvY29kZT4gYXJlIG91dC1vZi1ib3VuZHMuPC9wPgogICAgICAgPHA+VGhlIDxkZm4gaWQ9ImRm
bi1udW1iZXJPZkNoYW5uZWxzIj5udW1iZXJPZkNoYW5uZWxzPC9kZm4+IHBhcmFtZXRlcgogICAg
ICAgZGV0ZXJtaW5lcyBob3cgbWFueSBjaGFubmVscyB0aGUgYnVmZmVyIHdpbGwgaGF2ZS4gIEFu
IGltcGxlbWVudG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5DcmVhdGVz
IGFuIEF1ZGlvQnVmZmVyIGdpdmVuIHRoZSBhdWRpbyBmaWxlIGRhdGEgY29udGFpbmVkIGluIHRo
ZQogICAgICAgQXJyYXlCdWZmZXIuIFRoZSBBcnJheUJ1ZmZlciBjYW4sIGZvciBleGFtcGxlLCBi
ZSBsb2FkZWQgZnJvbSBhbiBYTUxIdHRwUmVxdWVzdCdzCiAgICAgICAgIDxjb2RlPnJlc3BvbnNl
PC9jb2RlPiBhdHRyaWJ1dGUgYWZ0ZXIgc2V0dGluZyB0aGUgPGNvZGU+cmVzcG9uc2VUeXBlPC9j
b2RlPiB0byAiYXJyYXlidWZmZXIiLgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>1337</attachid>
            <date>2013-03-13 15:08:44 +0000</date>
            <delta_ts>2013-03-13 15:08:44 +0000</delta_ts>
            <desc>Patch</desc>
            <filename>x</filename>
            <type>text/plain</type>
            <size>1872</size>
            <attacher name="Ehsan Akhgari [:ehsan]">ehsan</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3dlYmF1ZGlvL3NwZWNpZmljYXRpb24uaHRtbCBiL3dlYmF1ZGlvL3NwZWNp
ZmljYXRpb24uaHRtbAotLS0gYS93ZWJhdWRpby9zcGVjaWZpY2F0aW9uLmh0bWwKKysrIGIvd2Vi
YXVkaW8vc3BlY2lmaWNhdGlvbi5odG1sCkBAIC05MDksMjUgKzkwOSwyNSBAQCBpbnRlcmZhY2Ug
PGRmbiBpZD0iZGZuLUF1ZGlvQ29udGV4dCI+QXVkCiA8L2RsPgogPC9kaXY+CiAKIDxkaXYgaWQ9
Im1ldGhvZHNhbmRwYXJhbXMtQXVkaW9Db250ZXh0LXNlY3Rpb24iIGNsYXNzPSJzZWN0aW9uIj4K
IDxoMyBpZD0ibWV0aG9kc2FuZHBhcmFtcy1BdWRpb0NvbnRleHQiPjQuMS4yLiBNZXRob2RzIGFu
ZCBQYXJhbWV0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