Skip to content

Commit

Permalink
Merge pull request #538 from alexylem/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
alexylem authored Apr 11, 2017
2 parents bdde289 + 516cfc4 commit 9a7f16a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions docs/api-reference-internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ Internal: Kill Jarvis if running in background
-----------

Internal: trigger hooks
* $1 - hook name to trigger
* $@ - other arguments to pass to hook


`jv_exit()`
Expand Down
6 changes: 3 additions & 3 deletions stt_engines/snowboy/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ stt_sb_train () {

# record 3 audio samples of the hotword
dialog_msg "We will record now 3 audio samples of '$hotword'\nSample #1\nPres [Enter], say '$hotword' then hit Ctrl+C"
rec -r 16000 -c 1 -b 16 -e signed-integer /tmp/1.wav
rec -r 16000 -c 1 -b 16 -e signed-integer gain $gain /tmp/1.wav
dialog_msg "Sample #2\nPres [Enter], say '$hotword' then hit Ctrl+C"
rec -r 16000 -c 1 -b 16 -e signed-integer /tmp/2.wav
rec -r 16000 -c 1 -b 16 -e signed-integer gain $gain /tmp/2.wav
dialog_msg "Sample #3\nPres [Enter], say '$hotword' then hit Ctrl+C"
rec -r 16000 -c 1 -b 16 -e signed-integer /tmp/3.wav
rec -r 16000 -c 1 -b 16 -e signed-integer gain $gain /tmp/3.wav

# get microphone information #103
#[ "$rec_hw" != "false" ] && local microphone=$(lsusb -d $(cat /proc/asound/card${rec_hw:3:1}/usbid) | cut -c 34-) || local microphone="Default"
Expand Down
5 changes: 3 additions & 2 deletions stt_engines/snowboy/maindecoder_sox.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def audio_callback(in_data, frame_count, time_info, status):

self.detector = snowboydetect.SnowboyDetect(
resource_filename=resource.encode(), model_str=model_str.encode())
self.detector.SetAudioGain(audio_gain)
self.audio_gain = int (audio_gain)
#self.detector.SetAudioGain( self.audio_gain ) #537
self.num_hotwords = self.detector.NumHotwords()
self.trigger_ticks = trigger_ticks

Expand All @@ -70,7 +71,7 @@ def record_proc(self):
CHUNK = 2048
RECORD_RATE = 16000
#cmd = 'arecord -q -r %d -f S16_LE' % RECORD_RATE
cmd = 'rec -q -r %d -c 1 -b 16 -e signed-integer --endian little -t wav -' % RECORD_RATE
cmd = 'rec -q -r %d -c 1 -b 16 -e signed-integer --endian little -t wav - gain %d' % (RECORD_RATE, self.audio_gain) #537
process = subprocess.Popen(cmd.split(' '), stdout = subprocess.PIPE, stderr = subprocess.PIPE)
wav = wave.open(process.stdout, 'rb')
while self.recording:
Expand Down
10 changes: 7 additions & 3 deletions utils/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ say () {
jv_success "HELP: Start Jarvis using ./jarvis.sh -b"
fi
else # if using Jarvis, speak synchronously
jv_hook "start_speaking"
jv_hook "start_speaking" "$1" #533
$tts_engine'_TTS' "$1"
jv_hook "stop_speaking"
fi
Expand Down Expand Up @@ -278,11 +278,15 @@ jv_kill_jarvis () {
}

# Internal: trigger hooks
# $1 - hook name to trigger
# $@ - other arguments to pass to hook
jv_hook () {
$jv_api && return # don't trigger hooks from API
source hooks/$1 $2 2>/dev/null # user hook
local hook="$1"
shift
source hooks/$hook "$@" 2>/dev/null # user hook
shopt -s nullglob
for f in plugins/*/hooks/$1; do source $f; done # plugins hooks
for f in plugins/*/hooks/$hook; do source $f "$@"; done # plugins hooks
shopt -u nullglob
}

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.04.08
17.04.11

0 comments on commit 9a7f16a

Please sign in to comment.