-
-
Save fragtastic/5ef35c131e240524b274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pocketsphinx-ruby' | |
require "espeak" | |
include ESpeak | |
require "require_all" | |
def run_listen | |
configuration = Pocketsphinx::Configuration::Grammar.new('grammars/activate.gram') | |
Speech.new("Loaded grammer/activate.gram").speak | |
recognizer = Pocketsphinx::LiveSpeechRecognizer.new(configuration) | |
Speech.new("Recognizer created") | |
recognizer.recognize do |speech| | |
case speech | |
when "activate" | |
Speech.new("Activated").speak | |
return run_listen | |
when "deactivate" | |
Speech.new("Deactivated").speak | |
return run_listen | |
end | |
end | |
end | |
Speech.new("Voice Control started.").speak | |
run_listen | |
# activate.gram | |
#JSGF V1.0; | |
#grammar module; | |
#public <command> = ( activate | deactivate ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment