Skip to main content

isDucked

Added in 6.5.0

Check whether a target is turned down at this moment, because one of the triggers you gave duck is playing and can be heard.

isDucked(target: string): boolean;

Parameters​

ParameterTypeDefaultDescription
targetstringrequiredA target name you passed to duck.

Returns​

boolean: true while a trigger plays, false otherwise. Also false for a name that has no duck.

Example​

soundHub.duck('music', { when: 'voice' });

soundHub.isDucked('music'); // false
soundHub.play('voice');
soundHub.isDucked('music'); // true

soundHub.pause('voice');
soundHub.isDucked('music'); // false, a paused trigger does not duck

Good to know​

  • It turns true the moment a trigger starts, before the attack ramp has finished, and false the moment the last trigger stops, before the release ramp has finished.
  • It says nothing about whether the target itself plays. A duck follows its triggers either way.
  • To react to the change rather than poll for it, listen for duck_started and duck_ended with addEventListener.

See also​