# Voice control as input

**URL:** <https://forum.hello-robot.com/t/voice-control-as-input/44>\
**Category:** Share\
**Created:** [July 22, 2020, 3:26am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44 "2020-07-22T03:26:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sitaneja](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@sitaneja](https://forum.hello-robot.com/u/sitaneja)\
**Post date:** [July 22, 2020, 3:26am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/1 "2020-07-22T03:26:02Z")

</div>

Is there any demo code to move any component of hello robot using voice command/input?

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [July 22, 2020, 3:59am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/2 "2020-07-22T03:59:40Z")

</div>

Hey @sitaneja, welcome to the forum! Check out this command line tool: [stretch\_robot\_respeaker\_teleop.py](https://github.com/hello-robot/stretch_body/blob/100c23a49b972a1dcaac003eadbe1bd56c096ece/tools/bin/stretch_robot_respeaker_teleop.py). Just as `stretch_robot_keyboard_teleop.py` is a quick way to teleoperate the robot around with a keyboard, `stretch_robot_respeaker_teleop.py` is how you would teleoperate Stretch around using voice commands.

The python script makes use of Mozilla’s offline speech-to-text engine, DeepSpeech v0.6.1, but you can use other online/offline solutions.

---

<div class="post-metadata">

**Author:** ![sitaneja](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@sitaneja](https://forum.hello-robot.com/u/sitaneja)\
**Post date:** [July 22, 2020, 6:06am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/3 "2020-07-22T06:06:26Z")

</div>

Would it require any additional library or tool to execute this code?

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [July 22, 2020, 2:59pm UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/4 "2020-07-22T14:59:52Z")

</div>

All of our command line tools/ROS repo’s requirements are installed at our factory. The install scripts can be found in [stretch\_install](https://github.com/hello-robot/stretch_install). Since `stretch_robot_respeaker_teleop.py` is currently in a feature branch (a work in progress), it’s requirements aren’t in stretch\_install yet.

I’ll send the setup steps when you’re ready with the robot.

---

<div class="post-metadata">

**Author:** ![FergusKidd](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/ferguskidd/32/143_2.png) [@FergusKidd](https://forum.hello-robot.com/u/FergusKidd)\
**Post date:** [June 30, 2021, 8:41am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/5 "2021-06-30T08:41:04Z")

</div>

Hi @sitaneja we also have some example code of how we have used Microsoft Azure’s speech to text and LUIS to control our stretch robot. We also include other functionality like text to speech and QnA maker so the stretch can answer back. We’re currently working on the repo as well as a blog post which will explain this in more detail.

> **[Avanade/emtech-stretch-labs](https://github.com/Avanade/emtech-stretch-labs)**
>
> Repositories related to Avanade's exploration with Rocos, NextMind and Hello Robot. - Avanade/emtech-stretch-labs

---

<div class="post-metadata">

**Author:** ![Lionel\_Zhang](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/lionel_zhang/32/181_2.png) [@Lionel\_Zhang](https://forum.hello-robot.com/u/Lionel_Zhang)\
**Post date:** [August 3, 2021, 12:31am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/6 "2021-08-03T00:31:44Z")

</div>

Hi @bshah,

I was wondering where I could find `stretch_robot_respeaker_teleop.py`? I could not find it in the stretch\_body repo anymore.

Thanks,  
Lionel

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [August 3, 2021, 6:50am UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/7 "2021-08-03T06:50:12Z")

</div>

Hi @Lionel_Zhang, you can find the script at this [commit](https://github.com/hello-robot/stretch_body/commit/01cb8055b79513adf7b00924105c10f05ea7c523?branch=01cb8055b79513adf7b00924105c10f05ea7c523&diff=unified), but I removed it from shipping by default because it didn’t perform reliably enough to teleop the robot with voice commands. If you’d like to test it out anyways, you can use the [following instructions](https://github.com/hello-robot/stretch_install/commit/2182609f14eb17e36135bd2ce914afaf3698d63f) to set up DeepSpeech and pull the script from the linked commit. Additionally, DeepSpeech has [released v0.9.3](https://github.com/mozilla/DeepSpeech/releases/tag/v0.9.3) since, so the installation procedure to use this new version may be different.

There are many ways the script could have been improved to perform voice teleop more reliably. If you are interested in using DeepSpeech, you might look into writing a [custom scorer](https://deepspeech.readthedocs.io/en/r0.9/Scorer.html#building-your-own-scorer) on just the keywords needed to teleop the robot. This would likely improve the model’s inferences.

---

<div class="post-metadata">

**Author:** ![Lionel\_Zhang](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/lionel_zhang/32/181_2.png) [@Lionel\_Zhang](https://forum.hello-robot.com/u/Lionel_Zhang)\
**Post date:** [August 3, 2021, 6:40pm UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/8 "2021-08-03T18:40:59Z")

</div>

Thanks, Binit. Do you remember if the sub-optimal performance was due to the mic quality/volume or the voice algorithm?

We’re actually not too interested in the voice teleop itself, I just wanted to test it quickly to see how well the mic works with a different program. The mic input volume seemed low when the user is standing around 1-2 meters away from the robot, but we haven’t done a lot of testing to see if it’s our app or the mic itself that is the problem. I was planning to play with it some more today.

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [August 3, 2021, 7:08pm UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/9 "2021-08-03T19:08:11Z")

</div>

For the voice teleop script, it’s likely a combination of both factors. ReSpeaker has a [tutorial for isolating voice](https://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/#extract-voice), and there’s other audio filtering techniques that would likely improve the quality of the audio.

For the low input volume problem, I’d start with easy changes, like tweaking volume settings in the OS Settings Center or within the recording app itself. Also, try other recording programs like [Audacity](https://www.audacityteam.org/). If the volume remains consistently low, I can suggest some other ideas for debugging the issue.

---

<div class="post-metadata">

**Author:** ![Lionel\_Zhang](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/lionel_zhang/32/181_2.png) [@Lionel\_Zhang](https://forum.hello-robot.com/u/Lionel_Zhang)\
**Post date:** [August 3, 2021, 7:42pm UTC](https://forum.hello-robot.com/t/voice-control-as-input/44/10 "2021-08-03T19:42:48Z")

</div>

Thanks for the suggestions. [pavucontrol](https://freedesktop.org/software/pulseaudio/pavucontrol/) seems to have alleviated the volume issue a bit after maxing out the input slider. The mic would not output any audio when standing ~1m away (at 100%), unless it was maxed out (at 153%). I’ll report back here if we need additional help.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/hello_robot2/original/1X/63148c54ec8ee0646db1d962f15ac344b71700e1.png)
