🍋
Menu
Audio

Fade

Fade (Audio Volume Transition)

A gradual increase (fade-in) or decrease (fade-out) of audio volume over a specified duration, used to create smooth beginnings and endings for tracks or to transition between audio segments.

技術的詳細

Fades are implemented by multiplying each audio sample by a gain envelope that transitions from 0.0 to 1.0 (fade-in) or 1.0 to 0.0 (fade-out) over the fade duration. Envelope curves include linear (constant rate of change), exponential (perceived as more natural for fade-outs), logarithmic (natural for fade-ins), S-curve/sigmoid (smooth acceleration and deceleration), and equal-power (maintains perceived loudness during crossfades). The Web Audio API's GainNode.gain.linearRampToValueAtTime() and exponentialRampToValueAtTime() provide native fade support. Crossfades overlap a fade-out with a fade-in for seamless transitions between two audio clips.

```javascript
// Fade: Web Audio API example
const audioCtx = new AudioContext();
const response = await fetch('audio.mp3');
const buffer = await audioCtx.decodeAudioData(await response.arrayBuffer());
const source = audioCtx.createBufferSource();
source.buffer = buffer;
source.connect(audioCtx.destination);
source.start();
```

関連ツール

関連用語