Table of Contents

Function Definition: stopallsounds()

Parameters

Description

The function will stop any sounds currently being played on all sprites and the Stage. Pressing the Stop button will also stop all sounds, but is rarely used as it also stops all the other scripts running in the project.

Example

Learn how to code logic for speech recognized control of Mars Rover with this example block code. You will be able to direct your own Mars Rover easily by just speaking commands.

Learn how to code logic for speech-recognized control of Mars Rover with this example block code. You will be able to direct your own Mars Rover easily by just speaking commands.

Introduction

A speech-recognized controlled Mars Rover robot is a robot that can recognize and interpret our speech, and verbal commands, given by a human. The code uses the speech recognition model that will be able to record and analyze your speech given and react accordingly on the Mars Rover.

Speech recognition robots can be used in manufacturing and other industrial settings to control machinery, perform quality control checks, and monitor equipment.

They are also used to help patients with disabilities to communicate with their caregivers, or to provide medication reminders and other health-related information.

Code

sprite=Sprite('Tobi')
import time
rover = MarsRover(4, 1, 7, 2, 6)
quarky = Quarky()
sr = SpeechRecognition()
ts = TexttoSpeech()
sr.analysespeech(4, "en-US")
command = sr.speechresult()
command = command.lower()
if 'forward' in command:
  rover.home()
  rover.setinangle(0)
  quarky.runtimedrobot("F",100,3)
elif 'back' in command:
  rover.home()
  rover.setinangle(0)
  quarky.runtimedrobot("B",100,3)
elif 'right' in command:
  rover.home()
  rover.setinangle(40)
  quarky.runtimedrobot("R",100,3)
elif 'left' in command:
  rover.home()
  rover.setinangle(40)
  quarky.runtimedrobot("L",100,3)

time.sleep(10)
sprite.stopallsounds()

Logic

  1. Firstly, the code initializes the Mars Rover pins and starts recording the microphone of the device to store the audio command of the user.
  2. The code then checks conditions whether the command included the word “Go” or not. You can use customized commands and test for different conditions on your own.
  3. If the first condition stands false, the code again checks for different keywords that are included in the command.
  4. When any condition stands true, the robot will align itself accordingly and move in the direction of the respective command.

Output

Forward-Backward Motions:

Right-Left Motions:

Read More
Learn how to code logic for speech recognized control of Mecanum with this example block code. You will be able to direct your own Mecanum easily by just speaking commands.

Learn how to code logic for speech recognized control of Mecanum with this example block code. You will be able to direct your own Mecanum easily by just speaking commands.

Introduction

A speech recognized controlled Mecanum robot is a robot that can recognize and interpret our speech, verbal commands, given by a human. The code uses the speech recognition model that will be able to record and analyze your speech given and react accordingly on the Mecanum.

Speech recognition robots can be used in manufacturing and other industrial settings to control machinery, perform quality control checks, and monitor equipment.

They are also used to help patients with disabilities to communicate with their caregivers, or to provide medication reminders and other health-related information.

Code

sprite=Sprite('Tobi')
import time
meca=Mecanum(1,2,7,8)
quarky = Quarky()
sr = SpeechRecognition()
ts = TexttoSpeech()
sr.analysespeech(4, "en-US")
command = sr.speechresult()
command = command.lower()
if 'forward' in command:
  meca.runtimedrobot("forward",100,2)
elif 'back' in command:
  meca.runtimedrobot("backward",100,2)
elif 'right' in command:
  meca.runtimedrobot("lateral right",100,2)
elif 'left' in command:
  meca.runtimedrobot("lateral left",100,2)

time.sleep(10)
sprite.stopallsounds()

Logic

  1. Firstly, the code initializes the Mecanum pins and starts recording the microphone of the device to store the audio command of the user.
  2. The code then checks conditions whether the command included the word “Go” or not. You can use customized commands and test for different conditions on your own.
  3. If the first condition stands false, the code again checks for different keywords that are included in the command.
  4. When any condition stands true, the robot will align itself accordingly and move in that direction of the respective command.

Output

Read More
All articles loaded
No more articles to load