brainsteam.co.uk/brainsteam/content/posts/2015-11-28-watson-home-auto...

50 lines
2.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Home automation with Raspberry Pi and Watson
author: James
type: post
date: 2015-11-28T10:57:14+00:00
url: /2015/11/28/watson-home-automation/
categories:
- Work
tags:
- automation
- home
- iot
- jasper
- pi
- raspberry
- speech
- speech-to-text
- stt
- text
- watson
---
I’ve recently been playing with trying to build a Watson powered home automation system using my Raspberry Pi and some other electronic bits that I have on hand.
There are already a lot of people doing work in this space. One of the most successful projects being [JASPER][1] which uses speech to text and an always on background listening microphone to talk to you and carry out actions when you ask it things in natural language like “What’s the weather going to be like tomorrow?” and “What is the meaning of life?” Jasper works using a library called [Sphinx][2] developed by Carnegie Mellon University to do speech recognition. However the models aren’t great – especially if you have a british accent.
Jasper also allows you to use other speech to text libraries and services too such as the [Google Speech service][3] and the [AT&T speech service][4]. However there is no currently available code for using the Watson speech to text API – until now.
The below code snippet can be added to your stt.py file in your jasper project.
Then you need to create a Watson speech-to-text instance in bluemix add the following to your JASPER configuration:
<pre>stt_engine: watson
stt_passive_engine: sphinx
watson-stt:
username: "&lt;Text-to-speech-credentials-username&gt;"
password: "&lt;Text-to-speech-credentials-password&gt;"</pre>
This configuration will use the local Sphinx engine to listen out for &#8220;JASPER&#8221; or whatever you choose to call your companion (which it is actually pretty good at) and then send off 10-15s of audio to Watson STT to be analysed more accurately once the trigger word has been detected. Here&#8217;s a video of the system in action:
<div class="jetpack-video-wrapper">
<span class="embed-youtube" style="text-align:center; display: block;"><iframe class='youtube-player' width='660' height='372' src='https://www.youtube.com/embed/MBDaJDPKrYE?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent' allowfullscreen='true' style='border:0;' sandbox='allow-scripts allow-same-origin allow-popups allow-presentation'></iframe></span>
</div>
[1]: http://jasperproject.github.io
[2]: http://cmusphinx.sourceforge.net/
[3]: http://jasperproject.github.io/documentation/configuration/#google-stt
[4]: http://jasperproject.github.io/documentation/configuration/#att-stt