AudioBufferSourceNode: detune property
The detune
property of the AudioBufferSourceNode
interface is a k-rate AudioParam
representing detuning of oscillation in cents.
For example, values of +100 and -100 detune the source up or down by one semitone, while +1200 and -1200 detune it up or down by one octave.
Value
A k-rate AudioParam
whose value indicates the detuning of oscillation in cents.
Note: Though the AudioParam
returned is read-only, the value it represents is not.
Examples
const audioCtx = new AudioContext();
const channelCount = 2;
const frameCount = audioCtx.sampleRate * 2.0;
const myArrayBuffer = audioCtx.createBuffer(
channelCount,
frameCount,
audioCtx.sampleRate,
);
for (let channel = 0; channel < channelCount; channel++) {
const nowBuffering = myArrayBuffer.getChannelData(channel);
for (let i = 0; i < frameCount; i++) {
nowBuffering[i] = Math.random() * 2 - 1;
}
}
const source = audioCtx.createBufferSource();
source.buffer = myArrayBuffer;
source.connect(audioCtx.destination);
source.detune.value = 100;
source.start();
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
detune |
44 |
13 |
40 |
No |
31 |
14.1 |
44 |
44 |
40 |
32 |
14.5 |
4.0 |
See also