diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/fr/web/api/audiobuffersourcenode/buffer | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/fr/web/api/audiobuffersourcenode/buffer')
-rw-r--r-- | files/fr/web/api/audiobuffersourcenode/buffer/index.html | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/files/fr/web/api/audiobuffersourcenode/buffer/index.html b/files/fr/web/api/audiobuffersourcenode/buffer/index.html new file mode 100644 index 0000000000..7973ada3dc --- /dev/null +++ b/files/fr/web/api/audiobuffersourcenode/buffer/index.html @@ -0,0 +1,154 @@ +--- +title: AudioBufferSourceNode.buffer +slug: Web/API/AudioBufferSourceNode/buffer +translation_of: Web/API/AudioBufferSourceNode/buffer +--- +<p>{{ APIRef("Web Audio API") }}</p> + +<div class="summary"> +<p>La propriété <code><strong>buffer</strong></code> de l'interface {{ domxref("AudioBufferSourceNode") }} donne la possibilité de lire un son en utilisant un {{domxref("AudioBuffer")}} comme ressource audio.</p> +</div> + +<p>Si la propriété <code>buffer</code> a la valeur NULL, elle définit un canal unique silencieux (chaque échantillon vaut 0).</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="syntaxbox"><em>AudioBufferSourceNode</em>.buffer = <em>soundBuffer</em>; +</pre> + +<h3 id="Valeur">Valeur</h3> + +<p>Un {{domxref("AudioBuffer")}} qui contient les données représentant le son que le noeud va lire.</p> + +<h2 id="Exemple">Exemple</h2> + +<div class="note"> +<p><strong>Note</strong>: pour un exemple complet, voir <a class="external external-icon" href="http://mdn.github.io/audio-buffer/">le code interprété</a>, ou <a class="external external-icon" href="https://github.com/mdn/audio-buffer">le code source</a>.</p> +</div> + +<pre class="brush: js;highlight[19]">var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate); + +button.onclick = function() { + // Remplit le buffer avec du bruit blanc; + // valeurs aléatoires entre -1.0 et 1.0 + for (var channel = 0; channel < channels; channel++) { + // Crée le ArrayBuffer qui contient effectivement les données + var nowBuffering = myArrayBuffer.getChannelData(channel); + for (var i = 0; i < frameCount; i++) { + // Math.random() is in [0; 1.0] + // audio doit être compris entre [-1.0; 1.0] + nowBuffering[i] = Math.random() * 2 - 1; + } + } + + // Crée un AudioBufferSourceNode. + // C'est le AudioNode à utiliser pour jouer un AudioBuffer + var source = audioCtx.createBufferSource(); + // Définit le buffer dans l'AudioBufferSourceNode + source.buffer = myArrayBuffer;</pre> + +<h2 id="Spécifications">Spécifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Spécification</th> + <th scope="col">Statut</th> + <th scope="col">Commentaire</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("Web Audio API", "#widl-AudioBufferSourceNode-buffer", "buffer")}}</td> + <td>{{Spec2("Web Audio API")}}</td> + <td>Définition initiale</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_navigateurs">Compatibilité navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)<sup>[2]</sup></th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Support basique</td> + <td>{{CompatNo}}<sup>[1]</sup></td> + <td>{{CompatVersionUnknown}}</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>Propriété <code>detune</code></td> + <td>{{CompatVersionUnknown}}</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>Fonctionnalité</th> + <th>Android</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)<sup>[2]</sup></th> + <th>Firefox OS</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Support basique</td> + <td>{{CompatNo}}</td> + <td>28 {{property_prefix("webkit")}}</td> + <td>{{CompatVersionUnknown}}</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>Propriété <code>detune</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</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] supprimé dans Chrome 44.0. Etait supporté avec un préfixe <code>webkit</code> depuis la version 14.</p> + +<p>[2] Firefox ne gère pas correctement la valeur <code>null</code>. Au lieu de produire un noeud avec un seul canal silencieux, le noeud devient inutilisable et est ignoré si on essaie de le connecter à un autre noeud.</p> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<p>{{page("/en-US/docs/Web/API/AudioBufferSourceNode","See_also")}}</p> |