aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/api/audioparam
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pl/web/api/audioparam
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/pl/web/api/audioparam')
-rw-r--r--files/pl/web/api/audioparam/index.html224
-rw-r--r--files/pl/web/api/audioparam/setvalueattime/index.html182
2 files changed, 406 insertions, 0 deletions
diff --git a/files/pl/web/api/audioparam/index.html b/files/pl/web/api/audioparam/index.html
new file mode 100644
index 0000000000..390e9726f5
--- /dev/null
+++ b/files/pl/web/api/audioparam/index.html
@@ -0,0 +1,224 @@
+---
+title: AudioParam
+slug: Web/API/AudioParam
+tags:
+ - API
+ - Audio
+ - AudioParam
+ - Interface
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+ - Web Audio API
+translation_of: Web/API/AudioParam
+---
+<p>{{APIRef("Web Audio API")}}</p>
+
+<div>
+<p>The <code>AudioParam</code> interface represents an audio-related parameter, usually a parameter of an {{domxref("AudioNode")}} (such as {{ domxref("GainNode.gain") }}). An <code>AudioParam</code> can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern.</p>
+</div>
+
+<p>There are two kinds of <code>AudioParam</code>, <em>a-rate</em> and <em>k-rate</em> parameters:</p>
+
+<ul>
+ <li id="a-rate">An <em>a-rate</em> <code>AudioParam</code> takes the current audio parameter value for each <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Basic_concepts_behind_Web_Audio_API#Audio_buffers.3A_frames.2C_samples_and_channels">sample frame</a> of the audio signal.</li>
+ <li id="k-rate">A <em>k-rate</em> <code>AudioParam</code> uses the same initial audio parameter value for the whole block processed, that is 128 sample frames.</li>
+</ul>
+
+<p>Each {{domxref("AudioNode")}} defines which of its parameters are <em>a-rate</em> or <em>k-rate</em> in the spec.</p>
+
+<p>Each <code>AudioParam</code> has a list of events, initially empty, that define when and how values change. When this list is not empty, changes using the <code>AudioParam.value</code> attributes are ignored. This list of events allows us to schedule changes that have to happen at very precise times, using arbitrary timelime-based automation curves. The time used is the one defined in {{domxref("AudioContext.currentTime")}}.</p>
+
+<h2 id="Properties">Properties</h2>
+
+<p><code>AudioParam</code><em> Inherits properties from its parent, </em><code>AudioNode</code>.</p>
+
+<dl>
+ <dt>{{domxref("AudioParam.defaultValue")}} {{readonlyInline}}</dt>
+ <dd>Represents the initial volume of the attribute as defined by the specific {{domxref("AudioNode")}} creating the <code>AudioParam</code>.</dd>
+ <dt>{{domxref("AudioParam.maxValue")}} {{readonlyInline}}</dt>
+ <dd>Represents the maximum possible value for the parameter's nominal (effective) range. </dd>
+ <dt>{{domxref("AudioParam.minValue")}} {{readonlyinline}}</dt>
+ <dd>Represents the minimum possible value for the parameter's nominal (effective) range. </dd>
+ <dt>{{domxref("AudioParam.value")}}</dt>
+ <dd>Represents the parameter's current volume as a floating point value; initially set to the value of <code>AudioParam.defaultValue</code>. Though it can be set, any modifications happening while there are automation events scheduled — that is events scheduled using the methods of the <code>AudioParam</code> — are ignored, without raising any exception.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p>AudioParam<em> Inherits methods from its parent, </em><code>AudioNode</code>.</p>
+
+<dl>
+ <dt>{{domxref("AudioParam.setValueAtTime()")}}</dt>
+ <dd>Schedules an instant change to the value of the <code>AudioParam</code> at a precise time, as measured against {{domxref("AudioContext.currentTime")}}. The new value is given in the <code>value</code> parameter.</dd>
+ <dt>{{domxref("AudioParam.linearRampToValueAtTime()")}}</dt>
+ <dd>Schedules a gradual linear change in the value of the <code>AudioParam</code>. The change starts at the time specified for the <em>previous</em> event, follows a linear ramp to the new value given in the <code>value</code> parameter, and reaches the new value at the time given in the <code>endTime</code> parameter.</dd>
+ <dt>{{domxref("AudioParam.exponentialRampToValueAtTime()")}}</dt>
+ <dd>Schedules a gradual exponential change in the value of the <code>AudioParam</code>. The change starts at the time specified for the <em>previous</em> event, follows an exponential ramp to the new value given in the <code>value</code> parameter, and reaches the new value at the time given in the <code>endTime</code> parameter.</dd>
+ <dt>{{domxref("AudioParam.setTargetAtTime()")}}</dt>
+ <dd>Schedules the start of a change to the value of the <code>AudioParam</code>. The change starts at the time specified in <code>startTime</code> and exponentially moves towards the value given by the <code>target</code> parameter. The exponential decay rate is defined by the <code>timeConstant</code> parameter, which is a time measured in seconds.</dd>
+ <dt>{{domxref("AudioParam.setValueCurveAtTime()")}}</dt>
+ <dd>Schedules the values of the <code>AudioParam</code> to follow a set of values, defined by the <code>values</code> {{domxref("Float32Array")}} scaled to fit into the given interval, starting at <code>startTime</code>, and having a specific <code>duration</code>.</dd>
+ <dt>{{domxref("AudioParam.cancelScheduledValues()")}}</dt>
+ <dd>Cancels all scheduled future changes to the <code>AudioParam</code>.</dd>
+ <dt>{{domxref("AudioParam.cancelAndHoldAtTime()")}}</dt>
+ <dd>Cancels all scheduled future changes to the <code>AudioParam</code> but holds its value at a given time until further changes are made using other methods. The new value is given in the <code>value</code> parameter.</dd>
+</dl>
+
+<h2 id="Examples">Examples</h2>
+
+<p>First, a basic example showing a {{domxref("GainNode")}} having its <code>gain</code> value set. <code>gain</code> is an example of an a-rate AudioParam, as the value can potentially be set differently for each sample frame of the audio.</p>
+
+<pre class="brush: js;highlight[5]">var AudioContext = window.AudioContext || window.webkitAudioContext;
+var audioCtx = new AudioContext();
+
+var gainNode = audioCtx.createGain();
+gainNode.gain.value = 0;</pre>
+
+<p>Next, an example showing a {{ domxref("BiquadFilterNode") }} having some values set. These are examples of k-rate AudioParam's, as the values are set for the entire audio block at once.</p>
+
+<pre class="brush: js;highlight[6,7,8]">var AudioContext = window.AudioContext || window.webkitAudioContext;
+var audioCtx = new AudioContext();
+
+var biquadFilter = audioCtx.createBiquadFilter();
+
+biquadFilter.type = "lowshelf";
+biquadFilter.frequency.value = 1000;
+biquadFilter.gain.value = 25;</pre>
+
+<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', '#the-audioparam-interface', 'AudioParam')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(14)}} {{property_prefix("webkit")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop(23)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>15 {{property_prefix("webkit")}}<br>
+ 22 (unprefixed)</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Unprefixed</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>minValue</code> and <code>maxValue</code></td>
+ <td>{{CompatChrome(52)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>39</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>cancelAndHoldAtTime()</code></td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android Webview</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatChrome(28)}} {{property_prefix("webkit")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile(25)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Unprefixed</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>minValue</code> and <code>maxValue</code></td>
+ <td>{{CompatChrome(52)}}</td>
+ <td>{{CompatChrome(52)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>39</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>cancelAndHoldAtTime()</code></td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
+</ul>
diff --git a/files/pl/web/api/audioparam/setvalueattime/index.html b/files/pl/web/api/audioparam/setvalueattime/index.html
new file mode 100644
index 0000000000..7d733e7b2b
--- /dev/null
+++ b/files/pl/web/api/audioparam/setvalueattime/index.html
@@ -0,0 +1,182 @@
+---
+title: AudioParam.setValueAtTime()
+slug: Web/API/AudioParam/setValueAtTime
+tags:
+ - API
+ - AudioParam
+ - Metodă
+ - Referencja
+ - Web Audio API
+ - setValueAtTime
+translation_of: Web/API/AudioParam/setValueAtTime
+---
+<p>{{ APIRef("Web Audio API") }}</p>
+
+<div>
+<p>Metoda <code>setValueAtTime()</code> interfejsu {{ domxref("AudioParam") }} odpowiada za precyzyjne przyporządkowanie nagłych zmian do wartości {{domxref("AudioParam")}} w określonym czasie względem {{domxref("AudioContext.currentTime")}}. Nowa wartość zostaje podana w wartości parametru.</p>
+</div>
+
+<h2 id="Składnia">Składnia</h2>
+
+<pre class="syntaxbox">var AudioParam = AudioParam.setValueAtTime(<em>value</em>, <em>startTime</em>)</pre>
+
+<h3 id="Parametry">Parametry</h3>
+
+<dl>
+ <dt>value</dt>
+ <dd>Liczba zmiennoprzecinkowa reprezentująca wartość <code>AudioParam</code> przyporządkuje się do podanego czasu.</dd>
+ <dt>startTime</dt>
+ <dd>Zmienna <code>double </code>reprezentująca czas (w sekundach) po {{ domxref("AudioContext") }} została utworzona jako pierwsza, dzięki czemu dochodzi do zmiany wartości. {{jsxref("TypeError")}} zostanie zwrócony, jeśli uzyskana wartość jest negatywna.</dd>
+</dl>
+
+<h3 id="Zwracanie_wartości_funkcji_(return)">Zwracanie wartości funkcji (return)</h3>
+
+<p>Odnośnik do obiektu <code>AudioParam</code>. W niektórych przeglądarkach wprowadzenie tego interfejsu zaskutkuje zwróceniem pustego typu danych (<code>void</code>).</p>
+
+<h2 id="Przykłady">Przykłady</h2>
+
+<p>Ten stosunkowo prosty przykład zawiera źródło mediaelementu z dwiema kontrolkami (sprawdź kod źródłowy poprzez nasze <a href="https://github.com/mdn/audio-param">repo audio-param</a> lub <a href="http://mdn.github.io/audio-param/">zobacz przykład live</a>). Jeśli kontrolki są wciśnięte, zmienna <code>currGain</code> jest inkrementowana/dekrementowana o 0.25. Wówczas metoda <code>setValueAtTime() </code>zostaje użyta do ustawienia wartości przedwzmacniacza (gain) jako równej currGain, jedną sekundę od teraz (audioCtx.currentTime + 1).</p>
+
+<pre class="brush: js;highlight[32,37]">// utworzenie kontekstu audio
+var AudioContext = window.AudioContext || window.webkitAudioContext;
+var audioCtx = new AudioContext();
+
+// podanie podstawowych zmiennych dla przykładu
+var myAudio = document.querySelector('audio');
+var pre = document.querySelector('pre');
+var myScript = document.querySelector('script');
+
+pre.innerHTML = myScript.innerHTML;
+
+var targetAtTimePlus = document.querySelector('.set-target-at-time-plus');
+var targetAtTimeMinus = document.querySelector('.set-target-at-time-minus');
+
+// utworzenie MediaElementAudioSourceNode
+// wprowadzenie HTMLMediaElement
+var source = audioCtx.createMediaElementSource(myAudio);
+
+// utworzenie parametrów <span class="st">przedwzmacniacz</span>a (gain node) i ustawienie wartości przedwzmacniacza na wartość 0.5
+var gainNode = audioCtx.createGain();
+gainNode.gain.value = 0.5;
+var currGain = gainNode.gain.value;
+
+// podłączenie AudioBufferSourceNode do gainNode
+// oraz gainNode do destynacji
+source.connect(gainNode);
+gainNode.connect(audioCtx.destination);
+
+// określenie, co ma się wykonać po kliknięciu
+targetAtTimePlus.onclick = function() {
+ currGain += 0.25;
+ gainNode.gain.setValueAtTime(currGain, audioCtx.currentTime + 1);
+}
+
+targetAtTimeMinus.onclick = function() {
+ currGain -= 0.25;
+ gainNode.gain.setValueAtTime(currGain, audioCtx.currentTime + 1);
+}</pre>
+
+<h2 id="Specyfikacje">Specyfikacje</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specifikacja</th>
+ <th scope="col">Status</th>
+ <th scope="col">Komentarz</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Audio API', '#widl-AudioParam-setValueAtTime-void-float-value-double-startTime', 'setValueAtTime')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Zgodność_z_przeglądarkami">Zgodność z przeglądarkami</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Cecha</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Wsparcie podstawowe</td>
+ <td>{{CompatChrome(14)}} {{property_prefix("webkit")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>23</td>
+ <td>{{CompatNo}}</td>
+ <td>15 {{property_prefix("webkit")}}<br>
+ 22 (unprefixed)</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Bez prefiksu</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Cecha</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Wsparcie podstawowe</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>25</td>
+ <td>1.2</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ <td>{{CompatChrome(28)}} {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Bez prefiksu</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Zobacz_również">Zobacz również</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web_Audio_API/Using_Web_Audio_API">Używanie Web Audio API</a></li>
+</ul>