AudioBufferSourceNode: detune プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年4月.
detune
は AudioBufferSourceNode
インターフェイスのプロパティで、k-rate の AudioParam
再生時の離調をセント単位で表します。
例えば、 +100 と -100 の値は半音ずつ上下に離調し、 +1200 と -1200 の値は 1 オクターブずつ上下に離調します。
値
A k-rate AudioParam
whose value indicates the detuning of oscillation in cents.
メモ: AudioParam
は読み取り専用の値を返しますが、値は読み取り専用ではありません。
例
js
const audioCtx = new AudioContext(); const channelCount = 2; const frameCount = audioCtx.sampleRate * 2.0; // 2 seconds const myArrayBuffer = audioCtx.createBuffer( channelCount, frameCount, audioCtx.sampleRate, ); for (let channel = 0; channel < channelCount; channel++) { const nowBuffering = myArrayBuffer.getChannelData(channel); for (let i = 0; i < frameCount; i++) { nowBuffering[i] = Math.random() * 2 - 1; } } const source = audioCtx.createBufferSource(); source.buffer = myArrayBuffer; source.connect(audioCtx.destination); source.detune.value = 100; // value in cents source.start();
仕様書
Specification |
---|
Web Audio API> # dom-audiobuffersourcenode-detune> |
ブラウザーの互換性
Loading…