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 Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 40.0 (40.0) Not supported ? ?
Feature Android Chrome Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support Not supported (Yes) (Yes) (Yes) Not supported Not supported ?

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/audiobuffersourcenode/detune