audio

@audio/spatial-panner1.2.0

Stereo panner

Stereo panner — constant-power panning

Status
calibrated
Updated
Family
spatial, 12 packages under it
Plugin
panner, effect, streaming, 1 parameter
Category
effects
Licence
MIT
Dependencies
none
Downloads
2,194 last month
Tests
66 in audiojs/spatial's CI, passed at 656b55c,

Listen

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
audio('/samples/music/modern/local-forecast.mp3').panner()

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html

Parameters

  • effect
  • streaming
pan
0
−1 to 1
import panner from '@audio/spatial-panner'

Constant-power (cos/sin law) stereo pan: collapses the input to mono, then splits it to left/right with equal-power gains so perceived loudness stays constant across the pan sweep. Modifies left/right in place.

panner(left, right, { pan: -0.5 })   // both modified in place
Param Default
pan 0 -1 (full left) .. 0 (center) .. +1 (full right)

pan(left, right, pans, moving) does the same in place and returns nothing, a host's block: the pan is pans[i] for sample i while moving is 1 (the gains worked out for each sample), pans[0] throughout when it is 0. The audio.js manifest glides a host's ramp of pan sample by sample into it, so a move is one line however the host cuts its calls; held, the gains are worked out once a block, as panner works them out.

Use when: static or automated stereo placement; the LFO-driven sweep is spatial-autopan.


Part of @audio/spatial — the spatial family umbrella.

MIT © audiojs