detune 特性为 AudioBufferSourceNode 接口是 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.

句法

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

注意: 虽然 AudioParam returned is read-only, the value it represents is not.

A k-rate AudioParam whose value indicates the detuning of oscillation in cents .

范例

const audioCtx = new AudioContext();
const channelCount = 2;
const frameCount = audioCtx.sampleRate * 2.0; // 2 seconds
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; // value in cents
source.start();
					

规范

规范 状态 注释
Web 音频 API
The definition of 'detune' in that specification.
工作草案

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
detune Chrome 44 Edge 13 Firefox 40 IE 不支持 No Opera 31 Safari 不支持 No WebView Android 44 Chrome Android 44 Firefox Android 40 Opera Android 32 Safari iOS ? Samsung Internet Android 4.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: