OscillatorNode.detune

OscillatorNodedetune 属性的接口是 a-rate AudioParam ,代表振荡频率的失谐量(cents)。

语法

var oscillator = audioCtx.createOscillator();
oscillator.detune.value = 100; // value in cents

Note: 虽然返回的 AudioParam 是只读的,但是它表示的值不是。

 值

一个 a-rate AudioParam 的值

示例

下面的例子使用 AudioContext 创建了一个 oscillator node。 这是已经在运行的例子,查看 Violent Theremin demo (see app.js 是相关源码)。

// create web audio api context
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();

// create Oscillator node
var oscillator = audioCtx.createOscillator();

oscillator.type = 'square';
oscillator.frequency.value = 440; // value in hertz
oscillator.detune.value = 100; // value in cents
oscillator.start();

说明

Specification Status Comment
Web Audio API
detune
Working Draft  

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 14 webkit (en-US) (Yes) 23 未实现 15 webkit (en-US)
22 (unprefixed)
6 webkit (en-US)
Feature Android Chrome Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support 未实现 28 webkit (en-US) (Yes) 25 1.2 未实现 未实现 webkit (en-US)

See also