Skip to content

Commit

Permalink
Add additional Sphinx engine functionality and tests
Browse files Browse the repository at this point in the history
- Add wake up/sleep functionality with options in the default
  config module.
- Add start asleep config option (default is on).
- Add set_keyphrase & unset_keyphrase engine methods for adding
  additional key phrases (issue #3).
- Extract some code from recognise_forever method into a new
  process_buffer method that can be used for streaming audio from
  other sources (issue #6).
  • Loading branch information
drmfinlay committed May 22, 2018
1 parent 6c4881a commit 33339b3
Show file tree
Hide file tree
Showing 3 changed files with 372 additions and 37 deletions.
12 changes: 12 additions & 0 deletions dragonfly/engines/backend_sphinx/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This Python file uses the following encoding: utf-8

"""
Default CMU Pocket Sphinx engine class configuration module
"""
Expand All @@ -8,9 +10,19 @@

# Configuration for the Pocket Sphinx decoder.
DECODER_CONFIG = DefaultConfig()

# Silence the decoder output by default.
DECODER_CONFIG.set_string("-logfn", os.devnull)

# Configuration for wake/sleep phrases
# Note that the following CMU Sphinx tutorial has some advice on keyword thresholds
# values: https://cmusphinx.github.io/wiki/tutoriallm/#keyword-lists
START_ASLEEP = True
WAKE_PHRASE = "wake up"
WAKE_PHRASE_THRESHOLD = 1e-20
SLEEP_PHRASE = "go to sleep"
SLEEP_PHRASE_THRESHOLD = 1e-40

# Keyword arguments given to the PyAudio.open method for opening a stream from a
# microphone. PyAudio streams are used by the engine to recognise speech from audio.
# You may wish to change the values to be optimal for the models you are using;
Expand Down

0 comments on commit 33339b3

Please sign in to comment.