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

[Voicing] implement Hands #388

Closed
zepumph opened this issue May 21, 2021 · 4 comments
Closed

[Voicing] implement Hands #388

zepumph opened this issue May 21, 2021 · 4 comments
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented May 21, 2021

From #363

@zepumph zepumph self-assigned this May 21, 2021
@zepumph
Copy link
Member Author

zepumph commented May 21, 2021

This is my helpful testing patch:

Index: js/accessibility/voicing/webSpeaker.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/accessibility/voicing/webSpeaker.js b/js/accessibility/voicing/webSpeaker.js
--- a/js/accessibility/voicing/webSpeaker.js	(revision 6734e11f7f1178eebeb2250aecd5601a8dc2ffb6)
+++ b/js/accessibility/voicing/webSpeaker.js	(date 1621619920176)
@@ -31,10 +31,10 @@
     this.voiceProperty = new Property( null );
 
     // @public {NumberProperty} - controls the speaking rate of Web Speech
-    this.voiceRateProperty = new NumberProperty( 1.0, { range: new Range( 0.75, 2 ) } );
+    this.voiceRateProperty = new NumberProperty( 2.0, { range: new Range( 0.75, 2 ) } );
 
     // {NumberProperty} - controls the pitch of the synth
-    this.voicePitchProperty = new NumberProperty( 1.0, { range: new Range( 0.5, 2 ) } );
+    this.voicePitchProperty = new NumberProperty( 1.2, { range: new Range( 0.5, 2 ) } );
 
     // @public {Emitter} - emits events when the speaker starts/stops speaking, with the Utterance that is
     // either starting or stopping
@@ -55,7 +55,7 @@
     this.initialized = false;
 
     // whether or ot the webSpeaker is enabled - if false, there will be no speech
-    this.enabledProperty = new BooleanProperty( false );
+    this.enabledProperty = new BooleanProperty( true );
 
     // @private {DerivedProperty} - Controls whether or not speech is allowed with synthesis.
     // This controlling Property can be set with setCanSpeakProperty.
@@ -215,7 +215,9 @@
       }
 
       // embeddding marks (for i18n) impact the output, strip before speaking
-      const speechSynthUtterance = new SpeechSynthesisUtterance( stripEmbeddingMarks( utterance.getTextToAlert() ) );
+      const textToAlert = utterance.getTextToAlert();
+      console.log( textToAlert );
+      const speechSynthUtterance = new SpeechSynthesisUtterance( stripEmbeddingMarks( textToAlert ) );
       speechSynthUtterance.voice = this.voiceProperty.value;
       speechSynthUtterance.pitch = this.voicePitchProperty.value;
       speechSynthUtterance.rate = this.voiceRateProperty.value;

@zepumph
Copy link
Member Author

zepumph commented May 21, 2021

I implemented a first pass without help text at the moment. the name is given on start drag, and on focus, and the object/context responses are exactly what they are for description. This is pretty much the most basic copying of logic from description that we could do, so I'm curious how it goes.

I implemented the individual hands, as well as the both hands alerts (with a new hard coded name called "Both Hands").

@BLFiedler mentioned that he had an interview set up for Monday, so it seems important to have something here to test. I think this could be that.

I made https://phet-dev.colorado.edu/html/ratio-and-proportion/1.1.0-preferences.5/phet/ratio-and-proportion_en_phet.html?fuzz to play with since voicing is not yet on master.

@zepumph
Copy link
Member Author

zepumph commented May 25, 2021

@terracoda noted that I didn't get the object response in on click/focus, I could do something like

Index: js/common/view/RatioHalf.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/view/RatioHalf.js b/js/common/view/RatioHalf.js
--- a/js/common/view/RatioHalf.js	(revision 43276b6cb4b895de91656c05641c6a223078ec36)
+++ b/js/common/view/RatioHalf.js	(date 1621977094233)
@@ -292,7 +292,15 @@
         config.setJumpingOverProportionShouldTriggerSound( true );
         viewSounds.boundarySoundClip.onStartInteraction();
 
-        this.voicingSpeakNameResponse();
+        this.voicingSpeakResponse( {
+
+          nameResponse: this.voicingNameResponse,
+          // TODO: Duplicated with description options, https://github.com/phetsims/ratio-and-proportion/issues/388
+          objectResponse: config.ratioLockedProperty.value ? config.ratioDescriber.getProximityToChallengeRatio() :
+                          config.ratioDescriber.getProximityToChallengeRatio(),
+          utterance: voicingUtterance
+        } );
+
       },
       drag: () => {
         this.isBeingInteractedWithProperty.value = true;
@@ -350,7 +358,15 @@
       focus: () => {
         config.cueArrowsState.keyboardFocusedProperty.value = true;
         viewSounds.grabSoundClip.play();
-        this.voicingSpeakNameResponse();
+        this.voicingSpeakResponse( {
+
+          nameResponse: this.voicingNameResponse,
+          // TODO: Duplicated with description options, https://github.com/phetsims/ratio-and-proportion/issues/388
+          objectResponse: config.ratioLockedProperty.value ? config.ratioDescriber.getProximityToChallengeRatio() :
+                          config.ratioDescriber.getProximityToChallengeRatio(),
+          utterance: voicingUtterance
+        } );
+
       },
       blur: () => {
         config.cueArrowsState.keyboardFocusedProperty.value = false;

Unfortunately I won't have time to get to it and create another dev version right now.

@zepumph zepumph mentioned this issue Nov 19, 2021
@zepumph
Copy link
Member Author

zepumph commented Nov 19, 2021

I'm going to restart this implementation, closing this for now, but it is noted when I pull out the both-hands implementation from the preferences branch.

@zepumph zepumph closed this as completed Nov 19, 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

1 participant