diff --git a/js/balloons-and-static-electricity/view/BASEView.js b/js/balloons-and-static-electricity/view/BASEView.js index 63dabd8b..42c9ad7e 100644 --- a/js/balloons-and-static-electricity/view/BASEView.js +++ b/js/balloons-and-static-electricity/view/BASEView.js @@ -20,6 +20,7 @@ import balloonsAndStaticElectricity from '../../balloonsAndStaticElectricity.js' import BASEA11yStrings from '../BASEA11yStrings.js'; import BASEQueryParameters from '../BASEQueryParameters.js'; import BalloonNode from './BalloonNode.js'; +import BalloonRubbingSoundGenerator from './BalloonRubbingSoundGenerator.js'; import BASESummaryNode from './BASESummaryNode.js'; import ControlPanel from './ControlPanel.js'; import PlayAreaGridNode from './PlayAreaGridNode.js'; @@ -83,7 +84,9 @@ class BASEView extends ScreenView { greenBalloonLabelString, this.layoutBounds, tandem.createTandem( 'yellowBalloonNode' ), - { labelContent: yellowBalloonLabelString } + { + labelContent: yellowBalloonLabelString + } ); const tetherAnchorPoint = new Vector2( model.yellowBalloon.positionProperty.get().x + 30, // a bit to the side of directly below the starting position @@ -105,7 +108,10 @@ class BASEView extends ScreenView { tandem.createTandem( 'greenBalloonNode' ), { labelContent: greenBalloonLabelString, - balloonVelocitySoundGeneratorOptions: { basisSound: greenBalloonDriftVelocityLoop } + balloonVelocitySoundGeneratorOptions: { basisSound: greenBalloonDriftVelocityLoop }, + balloonRubbingSoundGeneratorOptions: { + centerFrequency: BalloonRubbingSoundGenerator.DEFAULT_CENTER_FREQUENCY * 1.25 + } } ); this.greenBalloonTetherNode = new TetherNode( diff --git a/js/balloons-and-static-electricity/view/BalloonNode.js b/js/balloons-and-static-electricity/view/BalloonNode.js index 6277bfc9..287bff3e 100644 --- a/js/balloons-and-static-electricity/view/BalloonNode.js +++ b/js/balloons-and-static-electricity/view/BalloonNode.js @@ -81,6 +81,9 @@ class BalloonNode extends Node { // {Object} - options passed to the drift velocity sound generator balloonVelocitySoundGeneratorOptions: {}, + // {Object} - options passed to the balloon rubbing sound generator + balloonRubbingSoundGeneratorOptions: {}, + // pdom - this node will act as a container for more accessible content, its children will implement // most of the keyboard navigation containerTagName: 'div', @@ -244,9 +247,12 @@ class BalloonNode extends Node { ) ); // sound generation for when the balloon is being rubbed on the sweater - soundManager.addSoundGenerator( - new BalloonRubbingSoundGenerator( model.dragVelocityProperty, model.onSweaterProperty, model.touchingWallProperty ) - ); + soundManager.addSoundGenerator( new BalloonRubbingSoundGenerator( + model.dragVelocityProperty, + model.onSweaterProperty, + model.touchingWallProperty, + options.balloonRubbingSoundGeneratorOptions + ) ); // sound generation for when the balloon contacts the sweater const balloonHitsSweaterSoundClip = new SoundClip( balloonHitsSweaterSound, { diff --git a/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js b/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js index 7e5044d0..91b1e4a9 100644 --- a/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js +++ b/js/balloons-and-static-electricity/view/BalloonRubbingSoundGenerator.js @@ -16,7 +16,7 @@ import NoiseGenerator from '../../../../tambo/js/sound-generators/NoiseGenerator import balloonsAndStaticElectricity from '../../balloonsAndStaticElectricity.js'; // constants -const CENTER_FREQUENCY = 900; // Hz +const DEFAULT_CENTER_FREQUENCY = 800; // Hz const FREQUENCY_CHANGE_WITH_DIRECTION = 100; // Hz const UPDATE_PERIOD = 100; // ms const SMOOTHED_SPEED_TAPER_RATE = 0.01; // model units per second, empirically determined @@ -34,7 +34,7 @@ class BalloonRubbingSoundGenerator extends NoiseGenerator { options = merge( { noiseType: 'brown', - centerFrequency: CENTER_FREQUENCY, + centerFrequency: DEFAULT_CENTER_FREQUENCY, qFactor: 2, // {number} - The amount of sound produced by this sound generator varies based on what's going on with the input @@ -93,7 +93,7 @@ class BalloonRubbingSoundGenerator extends NoiseGenerator { else if ( dragVelocity.y < 0 ) { sign = -1; } - this.setBandpassFilterCenterFrequency( CENTER_FREQUENCY + sign * FREQUENCY_CHANGE_WITH_DIRECTION ); + this.setBandpassFilterCenterFrequency( options.centerFrequency + sign * FREQUENCY_CHANGE_WITH_DIRECTION ); } else if ( ( smoothedDragSpeed === 0 || !( onSweater || touchingWall ) ) && this.isPlaying ) { @@ -105,6 +105,9 @@ class BalloonRubbingSoundGenerator extends NoiseGenerator { } } +// statics +BalloonRubbingSoundGenerator.DEFAULT_CENTER_FREQUENCY = DEFAULT_CENTER_FREQUENCY; + balloonsAndStaticElectricity.register( 'BalloonRubbingSoundGenerator', BalloonRubbingSoundGenerator ); export default BalloonRubbingSoundGenerator; \ No newline at end of file