GainNode.gain

GainNode 介面的 gain 屬性是 a-rate (en-US) AudioParam (en-US),代表增益的數值。

語法

js
var audioCtx = new AudioContext();
var gainNode = audioCtx.createGain();
gainNode.gain.value = 0.5;

傳回值

一個 AudioParam (en-US).

備註: 雖然傳回的 AudioParam 是唯讀的,但是它所代表的值可以更改。

範例

See BaseAudioContext.createGain() (en-US) for example code showing how to use an AudioContext to create a GainNode, which is then used to mute and unmute the audio by changing the gain property value.

規格

Specification
Web Audio API
# dom-gainnode-gain

瀏覽器相容度

BCD tables only load in the browser

參見