Closed jbphet closed 3 months ago
supportsSound
and
supportsExtraSound
can be used to turn sound on for testing during development.
supportsSound: true
key-value pair to the phet
sub-object in the package.json
file for this simulation. See https://github.com/phetsims/friction/blob/main/package.json. This portion will look
something like this:
{
...
"phet": {
"simFeatures": {
"supportsSound": true,
...
}
},
...
}
supportsExtraSound: true
key-value pair
to the phet
sub-object in the package.json file for this simulation. The main effect that this is has is to add
the 'Extra Sound' item to the PhET menu. See https://github.com/phetsims/friction/blob/main/package.json.grunt update
to get the updated configuration into the HTML file.SoundPlayer.NO_SOUND
. Search through
the code base for example usages.SoundPlayer
(often a SoundClip
instance) and passing it in as an option for the sound player.
See Adding sound to common code if sound is not yet supported.ScreenView
files. Both approaches have
been used, and both are legit, and it probably depends on how much sound generation is needed and whether adding it
all to the ScreenView
file(s) is likely to make the file too large and/or difficult to maintain. As of this writing,
WavesScreenSoundView
is an example of a separate class where the sounds are hooked to the model, and
FrictionScreenView
is an example of where sound was interwoven with the visual view code. Note that in some cases it
is necessary to know what the user was doing that triggered the need for sound generation, and in these cases the
sound generation will need to be inside the view element so that the code has access to all the needed information. An
example where this often comes up is if different behavior is needed when a value was changed via keyboard interaction
versus mouse or touch interaction.SoundClip
, please search for usages of this type in the tambo demo and/or other sims to see examples of
how it is generally used.assets
directory. Make sure the names match, e.g. bonk.mp3
in the sounds
directory and bonk.wav
in the
assets
directory. Also make sure these names match the names in the sound design document.team
or other
lists in the credits, add them using the soundDesign
key.ready-for-testing
and have it tested with the other aspects
of the simulation through the publication process.Oops. I'd already set up an issue for this, see #144. Closing this as a duplicate.
The sound design for this sim has reached a point where we are ready to start doing some implementation. The sound design document can be found at https://docs.google.com/document/d/1cCTgD_Kwot348ypGgih3eyLFdEX0n8XboqDbq5ZUfUo/edit?usp=sharing. This issue is being set up to track the progress of the implementation.