Skip to main content

getGlobalPan

Get the current stereo pan of the master bus, as set by setGlobalPan.

getGlobalPan(): number;

Parameters​

This method takes no parameters.

Returns​

number: the master pan, from -1 (full left) to 1 (full right). 0 is centre.

Example​

import { SoundHub } from 'soundhub';

const soundHub = new SoundHub();
await soundHub.loadSound('music', '/audio/theme.mp3');

soundHub.setGlobalPan(0.25);
console.log(soundHub.getGlobalPan()); // 0.25

Good to know​

  • The value is read straight from the master stereo panner node, so it reflects what is applied to the mix.
  • Before any call to setGlobalPan it returns defaultPan from the hub config, 0 when not set.
  • Per-sound pans from setPan are not included.

See also​