Step 12: Coding the Pitch Slider

Goal:


Now let’s program what will happen when we move the PitchSlider.

This code will change the pitch of the TextToSpeech voice every time that the slider is moved.

Steps:

  1. Under the section labeled Blocks select PitchSlider.
  2. Grab and place the block labeled “when PitchSlider.PositionChanged”.
  3. Under Blocks select TextToSpeech1.
  4. Grab and place the block labeled “set TextToSpeech1.Country”.
  5. Change “Country” to say “Pitch”.
  6. On the “when PitchSlider.PositionChanged” block, hover your mouse over “thumbPosition”.
  7. Then grab the “get thumbPosition” block and place it inside the “set TextToSpeech1.Pitch” block.

Code:


Click to replay