W3cubDocs

/DOM

AudioBufferSourceNode.detune

The detune property of the AudioBufferSourceNode interface is an k-rate AudioParam representing detuning of oscillation in cents.

The range of the AudioParam value is -1200 to 1200.

Syntax

var source = audioCtx.createBufferSource();
source.detune.value = 100; // value in cents

Note: though the AudioParam returned is read-only, the value it represents is not.

Value

A k-rate AudioParam.

Example

var audioCtx = new AudioContext();

var channels = 2;
var frameCount = audioCtx.sampleRate * 2.0;

var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

for (var channel = 0; channel < channels; channel++) {
  var nowBuffering = myArrayBuffer.getChannelData(channel);
  for (var i = 0; i < frameCount; i++) {
    nowBuffering[i] = Math.random() * 2 - 1;
  }
}

var source = audioCtx.createBufferSource();
source.buffer = myArrayBuffer;
source.connect(audioCtx.destination);
source.detune.value = 100; // value in cents
source.start();

Specifications

Specification Status Comment
Web Audio API
The definition of 'detune' in that specification.
Working Draft

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) 40.0 (40.0) No support ? ?
Feature Android Chrome Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support No support (Yes) (Yes) (Yes) (Yes) No support No support ?

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/detune