From f562017e317e6a34d18e6a69df7150a4e40b3cd7 Mon Sep 17 00:00:00 2001 From: Josh Samuelson Date: Fri, 5 Dec 2014 07:52:05 -0800 Subject: [PATCH] Network connected to mochad --- speech.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/speech.rb b/speech.rb index 59b4466..718dd92 100644 --- a/speech.rb +++ b/speech.rb @@ -1,4 +1,5 @@ require 'pocketsphinx-ruby' +require 'socket' #Phrase to listen for listening_keyword = "house elf" @@ -6,12 +7,12 @@ command_list = { listening_keyword => "Listening", "living room light" => "pl a1 on", - "Turn off living room light" => "pl a1 off", + "turn off living room light" => "pl a1 off", "bedroom light" => "pl a2 on", - "Turn off bedroom light" => "pl a2 off", - "Play music" => "PM", - "Stop music" => "SM", - "Forget it" => "Forgotten" + "turn off bedroom light" => "pl a2 off", + "play music" => "PM", + "stop music" => "SM", + "forget it" => "Forgotten" } puts "Availible Commands:" @@ -30,13 +31,14 @@ recognizer = Pocketsphinx::LiveSpeechRecognizer.new(configuration) +s=TCPSocket.open("10.0.0.42",1099) #By default don't listen for anything but listening = false recognizer.recognize do |speech| if listening then - puts command_list[speech] - puts speech + + s.puts command_list[speech] #Stop listening after the command is done listening = false