aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/audiobuffersourcenode
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/audiobuffersourcenode
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/audiobuffersourcenode')
-rw-r--r--files/zh-cn/web/api/audiobuffersourcenode/audiobuffersourcenode/index.html64
-rw-r--r--files/zh-cn/web/api/audiobuffersourcenode/buffer/index.html81
-rw-r--r--files/zh-cn/web/api/audiobuffersourcenode/index.html225
-rw-r--r--files/zh-cn/web/api/audiobuffersourcenode/start/index.html84
4 files changed, 454 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/audiobuffersourcenode/audiobuffersourcenode/index.html b/files/zh-cn/web/api/audiobuffersourcenode/audiobuffersourcenode/index.html
new file mode 100644
index 0000000000..62202a1370
--- /dev/null
+++ b/files/zh-cn/web/api/audiobuffersourcenode/audiobuffersourcenode/index.html
@@ -0,0 +1,64 @@
+---
+title: AudioBufferSourceNode.AudioBufferSourceNode()
+slug: Web/API/AudioBufferSourceNode/AudioBufferSourceNode
+translation_of: Web/API/AudioBufferSourceNode/AudioBufferSourceNode
+---
+<p>{{APIRef("Web Audio API")}}</p>
+
+<p><span class="seoSummary"> <strong><code>AudioBufferSourceNode()</code></strong> 构造器创建一个新的 {{domxref("AudioBufferSourceNode")}} 实例.</span></p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">var audioBufferSourceNode = new AudioBufferSourceNode(context, options)</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<p><em>从 </em><em>{{domxref("AudioNodeOptions")}} 字典中继承变量</em>.</p>
+
+<dl>
+ <dt><em>内容</em></dt>
+ <dd>指向 {{domxref("AudioContext")}}.</dd>
+ <dt><em>选项</em> {{optional_inline}}</dt>
+ <dd>如下:
+ <ul>
+ <li><code>buffer</code>: An instance of {{domxref("AudioBuffer")}} to be played.</li>
+ <li><code>detune</code>: A value in cents to modulate the speed of audio stream rendering. Its nominal range is (-∞ to +∞). The default is <code>0</code>.</li>
+ <li><code>loop</code>: A boolean indicating whether the audio should play in a loop. The default is <code>false</code>. If the loop is dynamically modified during playback, the new value will take effect on the next processing block of audio.</li>
+ <li><code>loopEnd</code>: An optional value, in seconds, where looping should end if the loop attribute is <code>true</code>. The default is <code>0</code>. Its value is exclusive to the content of the loop. The sample frames, comprising the loop, run from the values <code>loopStart</code> to <code>loopEnd</code>-(1/<code>sampleRate</code>). It's sensible to set this to a value between 0 and the duration of the buffer. If <code>loopEnd</code> is less than 0, looping will end at 0. If <code>loopEnd</code> is greater than the duration of the buffer, looping will end at the end of the buffer. This attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and rounding to the nearest integer value. Thus, its behavior is independent of the value of the <code>playbackRate</code> parameter.</li>
+ </ul>
+
+ <ul>
+ <li><code>loopStart</code>: An optional value in seconds, where looping should end if the loop attribute is <code>true</code>. The default is <code>0</code>. It's sensible to set this to a value between 0 and the duration of the buffer. If <code>loopStart</code> is less than 0, looping will begin at 0. If <code>loopStart</code> is greater than the duration of the buffer, looping will begin at the end of the buffer. This attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and rounding to the nearest integer value. Thus, its behavior is independent of the value of the <code>playbackRate</code> parameter.</li>
+ <li><code>playbackRate</code>: The speed at which to render the audio stream. Its default value is <code>1</code>. This parameter is k-rate. This is a compound parameter with detune. Its nominal range is (-∞ to +∞).</li>
+ </ul>
+ </dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>A new {{domxref("AudioBufferSourceNode")}} object instance.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Audio API','#AudioBufferSourceNode','AudioBufferSourceNode()')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_Compatibility">Browser Compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("api.AudioBufferSourceNode.AudioBufferSourceNode")}}</p>
+</div>
diff --git a/files/zh-cn/web/api/audiobuffersourcenode/buffer/index.html b/files/zh-cn/web/api/audiobuffersourcenode/buffer/index.html
new file mode 100644
index 0000000000..39591c82ba
--- /dev/null
+++ b/files/zh-cn/web/api/audiobuffersourcenode/buffer/index.html
@@ -0,0 +1,81 @@
+---
+title: AudioBufferSourceNode.buffer
+slug: Web/API/AudioBufferSourceNode/buffer
+tags:
+ - API
+ - AudioBufferSourceNode
+ - Web Audio API
+translation_of: Web/API/AudioBufferSourceNode/buffer
+---
+<p>{{ APIRef("Web Audio API") }}</p>
+
+<p>{{ domxref("AudioBufferSourceNode") }} 接口的<span style='background-color: transparent; color: #333333; display: inline !important; float: none; font-family: "Open Sans",arial,x-locale-body,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal;'> </span><code style=""><strong style="border-bottom-style: none; border-bottom-width: 0px; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">buffer</strong></code><span style='background-color: transparent; color: #333333; display: inline !important; float: none; font-family: "Open Sans",arial,x-locale-body,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal;'> 属性提供了重复播放音频的能力,该音频使用 </span>{{domxref("AudioBuffer")}} 作为声音文件的来源。</p>
+
+<p>如果 <code>buffer</code> 属性的值为 <code>null</code>, 节点会自动生成一个单声道的无声文件(所有采样均为0)。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>AudioBufferSourceNode</em>.buffer = <em>soundBuffer</em>;
+</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>{{domxref("AudioBuffer")}},<span style='background-color: transparent; color: #333333; display: inline !important; float: none; font-family: "Open Sans",arial,x-locale-body,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal;'>包含了节点将要播放的声音数据</span>。</p>
+
+<h2 id="示例">示例</h2>
+
+<div class="note">
+<p>完整的示例请查看 <a class="external external-icon" href="http://mdn.github.io/audio-buffer/"> this code running live</a>,或  <a class="external external-icon" href="https://github.com/mdn/audio-buffer">view the source。</a></p>
+</div>
+
+<pre class="brush: js;highlight[19]">var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
+
+button.onclick = function() {
+ // Fill the buffer with white noise;
+ //just random values between -1.0 and 1.0
+ for (var channel = 0; channel &lt; channels; channel++) {
+ // This gives us the actual ArrayBuffer that contains the data
+ var nowBuffering = myArrayBuffer.getChannelData(channel);
+ for (var i = 0; i &lt; frameCount; i++) {
+ // Math.random() is in [0; 1.0]
+ // audio needs to be in [-1.0; 1.0]
+ nowBuffering[i] = Math.random() * 2 - 1;
+ }
+ }
+
+ // Get an AudioBufferSourceNode.
+ // This is the AudioNode to use when we want to play an AudioBuffer
+ var source = audioCtx.createBufferSource();
+ // set the buffer in the AudioBufferSourceNode
+ source.buffer = myArrayBuffer;</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("Web Audio API", "#widl-AudioBufferSourceNode-buffer", "buffer")}}</td>
+ <td>{{Spec2("Web Audio API")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>
+
+
+<p>{{Compat("api.AudioBufferSourceNode.buffer")}}</p>
+</div>
+
+<h2 id="相关链接">相关链接</h2>
+
+<p>{{page("/en-US/docs/Web/API/AudioBufferSourceNode","See_also")}}</p>
diff --git a/files/zh-cn/web/api/audiobuffersourcenode/index.html b/files/zh-cn/web/api/audiobuffersourcenode/index.html
new file mode 100644
index 0000000000..2d6ef36dae
--- /dev/null
+++ b/files/zh-cn/web/api/audiobuffersourcenode/index.html
@@ -0,0 +1,225 @@
+---
+title: AudioBufferSourceNode
+slug: Web/API/AudioBufferSourceNode
+translation_of: Web/API/AudioBufferSourceNode
+---
+<p>{{APIRef("Web Audio API")}}</p>
+
+<div class="summary">
+<p><span class="seoSummary"><strong><code>AudioBufferSourceNode</code></strong><strong> </strong>接口继承自</span>{{domxref("AudioScheduledSourceNode")}} <span class="seoSummary">,表现为一个音频源,它包含了一些写在内存中的音频数据,通常储存在一个ArrayBuffer对象中。在处理有严格的时间精确度要求的回放的情形下它尤其有用。比如播放那些需要满足一个指定节奏的声音或者那些储存在内存而不是硬盘或者来自网络的声音。为了播放那些有时间精确度需求但来自网络的流文件或者来自硬盘,则使用</span>{{domxref("AudioWorkletNode")}}来实现回放。</p>
+
+<p>{{InheritanceDiagram}}</p>
+</div>
+
+<p><code>AudioBufferSourceNode</code> 没有输入却有一个输出,其通道数与其 {{domxref("AudioBufferSourceNode.buffer", "buffer")}} 属性所指定的 <code>AudioBuffer</code> 相同。如果没有设置 buffer,也就是说 <code>buffer</code> 属性是 <code>null</code> 的话,输出将包含一个无声的单通道(每个采样点均为0)。</p>
+
+<p>一个 {{domxref("AudioBufferSourceNode")}} 只能被播放一次,也就是说,每次调用 {{domxref("AudioScheduledSourceNode.start", "start()")}} 之后,如果还想再播放一遍同样的声音,那么就需要再创建一个 <code>AudioBufferSourceNode</code>。庆幸的是,创建该节点的代价并不大,并且想要多次播放声音的话,实际上 <code>AudioBuffer</code> 也可以被重用。事实上,你可以用一种“阅后即焚”的方式来使用这些节点:创建节点,调用 <code>start()</code> 开始播放声音,然后,你甚至不需要再保留这个节点的引用了。声音播放完成之后,垃圾收集器会找个恰当的时机回收资源。</p>
+
+<p><code>多次调用 AudioBufferSourceNode.stop()</code> 是允许的。如果这时候 <code>AudioBufferSourceNode</code> 还没有到达缓冲区末尾的话,最近一次的调用将替换上一次的调用。</p>
+
+<p><br>
+ <img alt="The AudioBufferSourceNode takes the content of an AudioBuffer and m" src="https://mdn.mozillademos.org/files/9717/WebAudioAudioBufferSourceNode.png" style="display: block; height: 193px; margin: 0px auto; width: 365px;"></p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">输入数量</th>
+ <td><code>0</code></td>
+ </tr>
+ <tr>
+ <th scope="row">输出数量</th>
+ <td><code>1</code></td>
+ </tr>
+ <tr>
+ <th scope="row">频道数量</th>
+ <td>由相关的 {{domxref("AudioBuffer")}} 定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="属性">属性</h2>
+
+<p><em>从父级的 </em><em>{{domxref("AudioNode")}} 继承属性</em>.</p>
+
+<dl>
+ <dt>{{domxref("AudioBufferSourceNode.buffer")}}</dt>
+ <dd>是一个 {{domxref("AudioBuffer")}} 它定义了要播放的音频,当设置它的值为0时,它会定义一个静默的单通道。</dd>
+ <dt>{{domxref("AudioBufferSourceNode.detune")}}</dt>
+ <dd>Is a <a href="/zh-CN/docs/DOM/AudioParam#k-rate">k-rate</a> {{domxref("AudioParam")}} representing detuning of oscillation in <a href="http://en.wikipedia.org/wiki/Cent_%28music%29">cents</a>. Its default value is <code>0</code>.</dd>
+ <dt>{{domxref("AudioBufferSourceNode.loop")}}</dt>
+ <dd>Is a Boolean attribute indicating if the audio asset must be replayed when the end of the {{domxref("AudioBuffer")}} is reached. Its default value is <code>false</code>.</dd>
+ <dt>{{domxref("AudioBufferSourceNode.loopStart")}}</dt>
+ <dd>Is a double value indicating, in seconds, where in the {{domxref("AudioBuffer")}} the restart of the play must happen. Its default value is <code>0</code>.</dd>
+ <dt>{{domxref("AudioBufferSourceNode.loopEnd")}}</dt>
+ <dd>Is a double value indicating, in seconds, where in the {{domxref("AudioBuffer")}} the replay of the play must stop (and eventually loop again). Its default value is <code>0</code>.</dd>
+ <dt>{{domxref("AudioBufferSourceNode.playbackRate")}}</dt>
+ <dd>Is an <a href="/en-US/docs/Web/API/AudioParam#a-rate">a-rate</a> {{domxref("AudioParam")}} that defines the speed factor at which the audio asset will be played. Since no pitch correction is applied on the output, this can be used to change the pitch of the sample.</dd>
+</dl>
+
+<h3 id="事件">事件</h3>
+
+<dl>
+ <dt>{{domxref("AudioBufferSourceNode.onended")}}</dt>
+ <dd>是一个 {{domxref("EventHandler")}} 类型,包含了与 {{event("ended_(Web_Audio)", "ended")}} 相关联的结束事件。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p><em>从父级的 </em><em>{{domxref("AudioNode")}} 继承方法</em>. </p>
+
+<dl>
+ <dt>{{domxref("AudioBufferSourceNode.start()")}}</dt>
+ <dd>Schedules the start of the playback of the audio asset.</dd>
+ <dt>{{domxref("AudioBufferSourceNode.stop()")}}</dt>
+ <dd>Schedules the end of the playback of an audio asset.</dd>
+</dl>
+
+<h2 id="例子">例子</h2>
+
+<p>在这个例子中, 我们将会创建一个2秒的缓冲器,并用白噪音填充它, 然后通过{{domxref("AudioBufferSourceNode")}}来播放它.  注释里说明了它的功能.</p>
+
+<div class="note">
+<p><span style="font-size: 14px;"><strong>注意</strong></span>: 你可以 <a class="external external-icon" href="http://mdn.github.io/audio-buffer/">查看在线演示</a> 或 <a class="external external-icon" href="https://github.com/mdn/audio-buffer">查看源代码</a>.</p>
+</div>
+
+<pre class="brush: js">var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
+var button = document.querySelector('button');
+var pre = document.querySelector('pre');
+var myScript = document.querySelector('script');
+
+pre.innerHTML = myScript.innerHTML;
+
+// Stereo
+var channels = 2;
+// Create an empty two-second stereo buffer at the
+// sample rate of the AudioContext
+var frameCount = audioCtx.sampleRate * 2.0;
+
+var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
+
+button.onclick = function() {
+ // Fill the buffer with white noise;
+ //just random values between -1.0 and 1.0
+ for (var channel = 0; channel &lt; channels; channel++) {
+ // This gives us the actual ArrayBuffer that contains the data
+ var nowBuffering = myArrayBuffer.getChannelData(channel);
+ for (var i = 0; i &lt; frameCount; i++) {
+ // Math.random() is in [0; 1.0]
+ // audio needs to be in [-1.0; 1.0]
+ nowBuffering[i] = Math.random() * 2 - 1;
+ }
+ }
+
+ // Get an AudioBufferSourceNode.
+ // This is the AudioNode to use when we want to play an AudioBuffer
+ var source = audioCtx.createBufferSource();
+ // set the buffer in the AudioBufferSourceNode
+ source.buffer = myArrayBuffer;
+ // connect the AudioBufferSourceNode to the
+ // destination so we can hear the sound
+ source.connect(audioCtx.destination);
+ // start the source playing
+ source.start();
+}</pre>
+
+<div class="note">
+<p><span style="font-size: 14px;"><strong>注意</strong></span>: 音频数据解码的例子请查看 {{domxref("AudioContext.decodeAudioData")}} 页面.</p>
+</div>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Audio API', '#the-audiobuffersourcenode-interface', 'AudioBufferSourceNode')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>14 {{property_prefix("webkit")}}<sup>[1]</sup></td>
+ <td>{{CompatGeckoDesktop("23.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>15 {{property_prefix("webkit")}}<br>
+ 22</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td><code>detune</code> property</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("40.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>28 {{property_prefix("webkit")}}<sup>[1]</sup></td>
+ <td>{{CompatGeckoMobile("25.0")}}</td>
+ <td>1.2</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td><code>detune</code> property</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] As of Chrome 42.0 setting AudioBufferSourceNode.buffer more than once is deprecated. A deprecation message is displayed if the buffer attribute is assigned more than once.</p>
+
+<h2 id="相关页面">相关页面</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/audiobuffersourcenode/start/index.html b/files/zh-cn/web/api/audiobuffersourcenode/start/index.html
new file mode 100644
index 0000000000..0975fa5c24
--- /dev/null
+++ b/files/zh-cn/web/api/audiobuffersourcenode/start/index.html
@@ -0,0 +1,84 @@
+---
+title: AudioBufferSourceNode.start()
+slug: Web/API/AudioBufferSourceNode/start
+translation_of: Web/API/AudioBufferSourceNode/start
+---
+<p>{{ APIRef("Web Audio API") }}</p>
+
+<div>
+<p> {{ domxref("AudioBufferSourceNode") }} 接口的<code>start()</code>方法用于计划对缓冲区中包含的音频数据的回放,或者立即开始回放。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>AudioBufferSourceNode</em>.start([<em>when</em>][, <em>offset</em>][, <em>duration</em>]);
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>when</code> {{optional_inline}}</dt>
+ <dd>The time声音开始播放的时间,单位是秒,与 {{domxref("AudioContext")}}使用相同的时间坐标系统. 如果 <code>when</code> 小于 ({{domxref("AudioContext.currentTime")}}, 或者是0,声音立即被播放。 <strong>默认值是0。</strong></dd>
+ <dt><code>offset</code> {{optional_inline}}</dt>
+ <dd>An offset, specified as the number of seconds in the same time coordinate system as the <code>AudioContext</code>, to the time within the audio buffer that playback should begin. For example, to start playback halfway through a 10-second audio clip, <code>offset</code> should be 5. The default value, 0, will begin playback at the beginning of the audio buffer, and offsets past the end of the audio which will be played (based on the audio buffer's {{domxref("AudioBuffer.duration", "duration")}} and/or the {{domxref("AudioBufferSourceNode.loopEnd", "loopEnd")}} property) are silently clamped to the maximum value allowed. The computation of the offset into the sound is performed using the sound buffer's natural sample rate, rather than the current playback rate, so even if the sound is playing at twice its normal speed, the midway point through a 10-second audio buffer is still 5.</dd>
+ <dt><code>duration</code> {{optional_inline}}</dt>
+ <dd>将要播放的声音的持续时间,指定单位为秒。如果这个参数没有被指定,声音播放到自然结束或者使用{{domxref("AudioScheduledSourceNode.stop", "stop()")}} 方法结束。使用这个参数的功能与调用 <code>start(when, offset)</code> 和调用 <code>stop(when+duration)</code>完全相同。</dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<p>{{jsxref("undefined")}}.</p>
+
+<h3 id="异常">异常</h3>
+
+<dl>
+ <dt><code>TypeError</code></dt>
+ <dd>A negative value was specified for one or more of the three time parameters. Please don't attempt to tamper with the laws of temporal physics.</dd>
+ <dt><code>InvalidStateError</code></dt>
+ <dd><code>start()</code> 已经被调用。在一个<code>AudioBufferSourceNode</code>的生命周期内只能调用一次这个函数。</dd>
+</dl>
+
+<h2 id="例子">例子</h2>
+
+<p>The most simple example just starts the audio buffer playing from the beginning — you don't need to specify any parameters in this case:</p>
+
+<pre class="brush: js">source.start();</pre>
+
+<p>The following more complex example will, 1 second from now, start playing 10 seconds worth of sound starting 3 seconds into the audio buffer.</p>
+
+<pre class="brush: js">source.start(audioCtx.currentTime + 1,3,10);</pre>
+
+<div class="note">
+<p>For a more complete example showing <code>start()</code> in use, check out our {{domxref("AudioContext.decodeAudioData()")}} example, You can also <a class="external external-icon" href="http://mdn.github.io/decode-audio-data/">run the code example live</a>, or <a class="external external-icon" href="https://github.com/mdn/decode-audio-data">view the source</a>.</p>
+</div>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Audio API', '#widl-AudioBufferSourceNode-start-void-double-when-double-offset-double-duration', 'start()')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("api.AudioBufferSourceNode.start")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
+</ul>