Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with sound ducking #521

Open
pixelzoom opened this issue Apr 16, 2021 · 1 comment
Open

Issues with sound ducking #521

pixelzoom opened this issue Apr 16, 2021 · 1 comment

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 16, 2021

Noted in phetsims/fourier-making-waves#55, where I was asked to use WaveMeterNode.js as an example of how to duck sounds.

In WaveMeterNode.js:

    // Turn down the water drops, speaker or light sound when the wave meter is being used.
    this.duckingProperty = new DerivedProperty( [ series1PlayingProperty, series2PlayingProperty ], ( a, b ) => {
      if ( a || b ) {
        return 0.3;
      }
      else {
        return 1;
      }
    } );

And then that Property is observed elsewhere, to set the output of sound clips.

Problems:

(1) Insufficient documentation for duckingProperty. It's actually {number} and it's an output level.

(2) You're assuming (and hardcoding) a default output level of 1. That's incredibly brittle. Ditto for the ducked output level; it should be a function of the normal output level.

(3) This could be done without a Property, and with less coupling, by creating a sound category for the 3 clips that you want to duck. Then use soundManager.setOutputLevelForCategory to change their output level.

@samreid
Copy link
Member

samreid commented Jul 4, 2021

Unassigning until we return our attention to this sim.

@samreid samreid removed their assignment Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants