AudioBufferSourceNode.detune

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.

La propriété detune de l'interface AudioBufferSourceNode est un AudioParam de type k-rate représentant le désaccord des oscillations en cents.

Ses valeur sont comprises entre -1200 et 1200.

Syntaxe

js
var source = contexteAudio.createBufferSource();
source.detune.value = 100; // valeur en cents

Note : Bien que l'AudioParam renvoyé soit en lecture seule, la valeur qu'il représente ne l'est pas.

Valeur

Un AudioParam de type k-rate.

Exemple

js
var audioCtx = new AudioContext();

var nbChan = 2;
var nbFrames = audioCtx.sampleRate * 2.0;

var audioBuffer = audioCtx.createBuffer(nbChan, nbFrames, audioCtx.sampleRate);

for (var chan = 0; chan < nbChan; chan++) {
  var chanData = audioBuffer.getChannelData(chan);
  for (var i = 0; i < nbFrames; i++) {
    chanData[i] = Math.random() * 2 - 1;
  }
}

var source = audioCtx.createBufferSource();
source.buffer = audioBuffer;
source.connect(audioCtx.destination);
source.detune.value = 100; // valeur en cents
source.start();

Spécifications

Specification
Web Audio API
# dom-audiobuffersourcenode-detune

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
detune

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Voir aussi