OscillatorNode: thuộc tính detune

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính detune của giao diện OscillatorNode là một AudioParam a-rate đại diện cho độ chỉnh âm của dao động tính bằng cents.

Note: Mặc dù AudioParam trả về là chỉ đọc, giá trị mà nó đại diện thì không.

Giá trị

Một AudioParam a-rate.

Ví dụ

Ví dụ dưới đây cho thấy cách sử dụng cơ bản của AudioContext để tạo oscillator node. Để xem ví dụ được áp dụng/thông tin, hãy xem Violent Theremin demo (xem app.js để biết mã liên quan).

js
// create web audio api context
const audioCtx = new AudioContext();

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

oscillator.type = "square";
oscillator.frequency.setValueAtTime(440, audioCtx.currentTime); // value in hertz
oscillator.detune.setValueAtTime(100, audioCtx.currentTime); // value in cents
oscillator.start();

Thông số kỹ thuật

Thông số kỹ thuật
Web Audio API
# dom-oscillatornode-detune

Tương thích trình duyệt

Xem thêm