GainNode

Baseline Widely available

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

GainNode 介面代表的是音量改變。 這是 AudioNode 音訊處理模組,可以對輸入的訊號做增益 (gain) 後輸出。一個 GainNode 有一個輸入和一個輸出,兩者有相同的聲道數。

增益 (gain) 是無單位的數值,隨時間變化,會用來和所有輸入聲道的取樣做相乘。 如果更改的話,新的增益會用 de-zippering 演算法處理,以避免輸出聲音出現難聽的「喀」聲。

The GainNode is increasing the gain of the output.

Number of inputs 1
Number of outputs 1
Channel count mode "max"
Channel count 2 (not used in the default count mode)
Channel interpretation "speakers"

Constructor

GainNode()

Creates a new instance of an GainNode object.

Properties

Inherits properties from its parent, AudioNode.

GainNode.gain Read only

a-rate AudioParam ,代表增益值

Methods

No specific method; inherits methods from its parent, AudioNode.

Example

See BaseAudioContext.createGain() for example code showing how to use an AudioContext to create a GainNode.

Specifications

Specification
Web Audio API
# GainNode

Browser compatibility

BCD tables only load in the browser

See also