aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/audiobuffer/numberofchannels
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/ja/web/api/audiobuffer/numberofchannels
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/audiobuffer/numberofchannels')
-rw-r--r--files/ja/web/api/audiobuffer/numberofchannels/index.html122
1 files changed, 122 insertions, 0 deletions
diff --git a/files/ja/web/api/audiobuffer/numberofchannels/index.html b/files/ja/web/api/audiobuffer/numberofchannels/index.html
new file mode 100644
index 0000000000..4c829b3eb2
--- /dev/null
+++ b/files/ja/web/api/audiobuffer/numberofchannels/index.html
@@ -0,0 +1,122 @@
+---
+title: AudioBuffer.numberOfChannels
+slug: Web/API/AudioBuffer/numberOfChannels
+translation_of: Web/API/AudioBuffer/numberOfChannels
+---
+<p>{{ APIRef("Web Audio API") }}</p>
+
+<div>
+<p>インターフェースの<code>numberOfChannelsプロパティは、</code>バッファに格納されたPCMデータのチャンネルの数をintegerで返します。</p>
+</div>
+
+<h2 id="構文">構文</h2>
+
+<pre class="brush: js;highlight[22]">var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
+myArrayBuffer.numberOfChannels;</pre>
+
+<h3 id="値">値</h3>
+
+<p>integer</p>
+
+<h2 id="例">例</h2>
+
+<pre class="brush: js;highlight[22]">// ステレオ
+var channels = 2;
+
+// AudioContextのサンプルレートで2秒間の空のステレオバッファを生成する
+var frameCount = audioCtx.sampleRate * 2.0;
+var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
+
+button.onclick = function() {
+ // バッファにホワイトノイズを書き込む;
+  // 単なる-1.0から1.0の間の乱数の値である
+ for (var channel = 0; channel &lt; channels; channel++) {
+ // 実際のデータの配列を得る
+ var nowBuffering = myArrayBuffer.getChannelData(channel);
+ for (var i = 0; i &lt; frameCount; i++) {
+ // Math.random()は[0; 1.0]である
+      // 音声は[-1.0; 1.0]である必要がある
+ nowBuffering[i] = Math.random() * 2 - 1;
+ }
+ }
+
+ console.log(myArrayBuffer.numberOfChannels);
+}</pre>
+
+<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', '#widl-AudioBuffer-numberOfChannels', 'numberOfChannels')}}</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")}}</td>
+ <td>23</td>
+ <td>{{CompatNo}}</td>
+ <td>15 {{property_prefix("webkit")}}<br>
+ 22 (unprefixed)</td>
+ <td>6 {{property_prefix("webkit")}}</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")}}</td>
+ <td>25</td>
+ <td>1.2</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<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>