diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-10-02 17:20:14 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-10-02 17:30:20 +0200 |
| commit | c05efa8d7ae464235cf83d7c0956e42dc6974103 (patch) | |
| tree | 6ea911b2f2010f63a026de6bb7a1a51e7690a7e1 /files/fr/web/api/analysernode/getbytetimedomaindata/index.html | |
| parent | 13a5e017558b248ee1647d4a5825f183b51f09ad (diff) | |
| download | translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.tar.gz translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.tar.bz2 translated-content-c05efa8d7ae464235cf83d7c0956e42dc6974103.zip | |
move *.html to *.md
Diffstat (limited to 'files/fr/web/api/analysernode/getbytetimedomaindata/index.html')
| -rw-r--r-- | files/fr/web/api/analysernode/getbytetimedomaindata/index.html | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/files/fr/web/api/analysernode/getbytetimedomaindata/index.html b/files/fr/web/api/analysernode/getbytetimedomaindata/index.html deleted file mode 100644 index 1610af5c55..0000000000 --- a/files/fr/web/api/analysernode/getbytetimedomaindata/index.html +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: AnalyserNode.getByteTimeDomainData() -slug: Web/API/AnalyserNode/getByteTimeDomainData -translation_of: Web/API/AnalyserNode/getByteTimeDomainData ---- -<p>{{ APIRef("Mountain View APIRef Project") }}</p> - -<div> -<p>La méthode <strong><code>getByteTimeDomainData()</code></strong> de l'interface {{ domxref("AnalyserNode") }} copie les données de forme d'onde, ou du domaine temporel, dans un tableau {{domxref("Uint8Array")}} passé en paramètre.</p> - -<p>Si le tableau a moins d'éléments que la propriété {{domxref("AnalyserNode.fftSize")}}, les données en excès sont supprimées. S'il a davantage d'éléments, les éléments non utilisés sont ignorés.</p> -</div> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="brush: js">var contexteAudio = new AudioContext(); -var analyseur = contexteAudio.createAnalyser(); - -// La taille du tableau Uint8Array doit correspondre à la valeur de la propriété fftSize -var tableauDonnees = new Uint8Array(analyseur.fftSize); - -// remplit le tableau Uint8Array avec les données renvoyées par la méthode getByteTimeDomainData() -analyseur.getByteTimeDomainData(tableauDonnees); </pre> - -<h3 id="Renvoie">Renvoie</h3> - -<p>Un tableau {{domxref("Uint8Array")}}.</p> - -<h2 id="Exemple">Exemple</h2> - -<p>L'exemple suivant montre comment créer simplement un <code>AnalyserNode</code> avec {{domxref("AudioContext")}}, puis utiliser {{domxref("window.requestAnimationFrame()","requestAnimationFrame")}} et {{htmlelement("canvas")}} pour collecter les données temporelles et dessiner un oscilloscope en sortie. Pour des exemples plus complets, voir notre démo <a href="https://mdn.github.io/voice-change-o-matic/">Voice-change-O-matic</a> (et en particulier <a href="https://github.com/mdn/voice-change-o-matic/blob/gh-pages/scripts/app.js#L128-L205">app.js lignes 128–205</a>).</p> - -<pre class="brush: js">var contexteAudio = new (window.AudioContext || window.webkitAudioContext)(); -var analyseur = contexteAudio.createAnalyser(); - - ... - -analyseur.fftSize = 2048; -var tailleMemoireTampon = analyseur.frequencyBinCount; -var tableauDonnees = new Uint8Array(tailleMemoireTampon); -analyseur.getByteTimeDomainData(tableauDonnees); - -// dessine un oscilloscope de la source audio - -function dessiner() { - - dessin = requestAnimationFrame(dessiner); - - analyseur.getByteTimeDomainData(tableauDonnees); - - contexteCanvas.fillStyle = 'rgb(200, 200, 200)'; - contexteCanvas.fillRect(0, 0, LARGEUR, HAUTEUR); - - contexteCanvas.lineWidth = 2; - contexteCanvas.strokeStyle = 'rgb(0, 0, 0)'; - - contexteCanvas.beginPath(); - - var largeurBarre = WIDTH * 1.0 / tailleMemoireTampon; - var x = 0; - - for(var i = 0; i < tailleMemoireTampon; i++) { - - var v = tableauDonnees[i] / 128.0; - var y = v * HAUTEUR/2; - - if(i === 0) { - contexteCanvas.moveTo(x, y); - } else { - contexteCanvas.lineTo(x, y); - } - - x += largeurBarre; - } - - contexteCanvas.lineTo(canvas.width, canvas.height/2); - contexteCanvas.stroke(); - }; - - dessiner();</pre> - -<h2 id="Paramètres">Paramètres</h2> - -<dl> - <dt>array</dt> - <dd>Le tableau {{domxref("Uint8Array")}} dans lequel les données temporelles seront copiées.</dd> -</dl> - -<h2 id="Spécifications">Spécifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spécification</th> - <th scope="col">Statut</th> - <th scope="col">Commentaire</th> - </tr> - <tr> - <td>{{SpecName('Web Audio API', '#widl-AnalyserNode-getByteTimeDomainData-void-Uint8Array-array', 'getByteTimeDomainData()')}}</td> - <td>{{Spec2('Web Audio API')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_navigateurs">Compatibilité navigateurs</h2> - -<p>{{Compat("api.AnalyserNode.getByteTimeDomainData")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a href="/fr/docs/Web_Audio_API/Using_Web_Audio_API">Utiliser la Web Audio API</a></li> -</ul> |
