AudioParam
是
interface
,
AudioNode
(
GainNode.gain
)实现了此接口.
AudioParam
有两种类型:
1.a-rate AudioParam 实时更改的
2.k-rate AudioParam 初始化设置的
属性
属性 | 描述 |
---|---|
AudioParam.defaultValue | 初始化的音量 |
AudioParam.maxValue | 最大值 |
AudioParam.minValue | 最小值 |
AudioParam.value | 当前的值,通过defaultValue初始化 |
方法
方法 | 描述 |
---|---|
AudioParam.setValueAtTime() |
改变当前值,传入
|
AudioParam.linearRampToValueAtTime() | 线性更改当前值 |
AudioParam.exponentialRampToValueAtTime() | 指数更改当前值 |
AudioParam.setTargetAtTime() | |
AudioParam.setValueCurveAtTime() | |
AudioParam.cancelScheduledValues() | |
AudioParam.cancelAndHoldAtTime() |
样例
1.a-rate AudioParam
var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
var gainNode = audioCtx.createGain();
gainNode.gain.value = 0;
2.k-rate AudioParam’
var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
var biquadFilter = audioCtx.createBiquadFilter();
biquadFilter.type = "lowshelf";
biquadFilter.frequency.value = 1000;
biquadFilter.gain.value = 25;
参考:
https://developer.mozilla.org/en-US/docs/Web/API/AudioParam
版权声明:本文为claroja原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。