Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexylem committed Mar 18, 2017
1 parent bea3999 commit cda97ee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 292 deletions.
19 changes: 0 additions & 19 deletions utils/audio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,6 @@ jv_play () {
fi
}

<<<<<<< HEAD:utils/audio.sh
=======
RECORD () { # RECORD () {} record microhphone to audio file $1 when sound is detected until silence
$verbose && local quiet='' || local quiet='-d'
[ -n "$2" ] && local timeout="utils/timeout.sh $2" || local timeout=""
[ $platform = "linux" ] && export AUDIODRIVER=alsa
local cmd="$timeout rec -V1 -q -r 16000 -c 1 -b 16 -e signed-integer --endian little $1 gain $gain silence 1 $min_noise_duration_to_start $min_noise_perc_to_start 1 $min_silence_duration_to_stop $min_silence_level_to_stop trim 0 5"
$verbose && jv_debug "$cmd"
eval $cmd # need eval because of timeout, maybe better to change this
local retcode=$?
[ $retcode -eq 124 ] && return 124 # timeout
if [ "$retcode" -ne 0 ]; then
jv_error "ERROR: rec command failed"
jv_warning "HELP: Verify your mic in Settings > Audio > Mic"
jv_exit 1
fi
}

>>>>>>> origin/pr/478:jarvis-functions.sh
jv_record_duration () {
local audiofile=$1
local duration=$2
Expand Down
273 changes: 0 additions & 273 deletions utils/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -442,276 +442,3 @@ EOM
esac
done
}
<<<<<<< HEAD
=======

while [ "$no_menu" = false ]; do
options=('Start Jarvis'
'Settings'
'Commands (what JARVIS can understand and execute)'
'Events (what JARVIS monitors and notifies you about)'
'Plugins (commands from community)'
'Search for updates'
'Help / Report a problem'
'About')
case "`dialog_menu \" Jarvis - v$jv_version\n$headline\" options[@]`" in
Start*)
while true; do
options=('Start normally' 'Troubleshooting mode' 'Keyboard mode' 'Start as a service')
case "`dialog_menu 'Start Jarvis' options[@]`" in
"Start normally")
break 2;;
"Troubleshooting mode")
verbose=true
break 2;;
"Keyboard mode")
keyboard=true
quiet=true
break 2;;
"Start as a service")
jv_start_in_background
exit;;
*) break;;
esac
done;;
Settings)
while true; do
options=('Step-by-step wizard'
'General'
'Phrases'
'Hooks'
'Audio'
'Voice recognition'
'Speech synthesis')
case "`dialog_menu 'Configuration' options[@]`" in
"General")
while true; do
options=("Username ($username)"
"Trigger mode ($trigger_mode)"
"Magic word ($trigger)"
"Show possible commands ($show_commands)"
"Multi-command separator ($separator)"
"Conversation mode ($conversation_mode)"
"Language ($language)"
"Check Updates on Startup ($check_updates)"
"Usage Statistics ($send_usage_stats)")
case "`dialog_menu 'Configuration > General' options[@]`" in
Username*) configure "username";;
Trigger*) configure "trigger_mode";;
Magic*word*) configure "trigger";;
Show*commands*) configure "show_commands";;
Multi-command*separator*) configure "separator";;
Conversation*) configure "conversation_mode";;
Language*) configure "language";;
Check*Updates*) configure "check_updates";;
Usage*Statistics*) configure "send_usage_stats";;
*) break;;
esac
done;;
"Phrases")
while true; do
options=("Startup greetings ($phrase_welcome)" "Trigger reply ($phrase_triggered)" "Unknown order ($phrase_misunderstood)" "Command failed ($phrase_failed)")
case "`dialog_menu 'Configuration > Phrases' options[@]`" in
Startup*greetings*) configure "phrase_welcome";;
Trigger*reply*) configure "phrase_triggered";;
Unknown*order*) configure "phrase_misunderstood";;
Command*failed*) configure "phrase_failed";;
*) break;;
esac
done;;
"Hooks")
while true; do
options=("Program startup"
"Program exit"
"Entering command mode"
"Exiting command mode"
"Start listening"
"Stop listening"
"Start speaking"
"Stop speaking")
case "`dialog_menu 'Configuration > Hooks' options[@]`" in
Program*startup*) configure "program_startup";;
Program*exit*) configure "program_exit";;
Entering*) configure "entering_cmd";;
Exiting*) configure "exiting_cmd";;
Start*listening*) configure "start_listening";;
Stop*listening*) configure "stop_listening";;
Start*speaking*) configure "start_speaking";;
Stop*speaking*) configure "stop_speaking";;
*) break;;
esac
done;;
"Audio")
while true; do
options=("Speaker ($play_hw)"
"Mic ($rec_hw)"
"Auto-adjust levels"
"Volume"
"Sensitivity"
"Gain ($gain)"
"Min noise duration to start ($min_noise_duration_to_start)"
"Min noise perc to start ($min_noise_perc_to_start)"
"Min silence duration to stop ($min_silence_duration_to_stop)"
"Min silence level to stop ($min_silence_level_to_stop)")
case "`dialog_menu 'Configuration > Audio' options[@]`" in
Speaker*) configure "play_hw";;
Mic*) configure "rec_hw";;
Auto*) jv_auto_levels;;
Volume) if [ "$platform" == "osx" ]; then
osascript <<EOM
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal (first anchor of current pane whose name is "output")
end tell
EOM
else
alsamixer -c ${play_hw:3:1} -V playback || read -p "ERROR: check above"
fi;;
Sensitivity)
if [ "$platform" == "osx" ]; then
osascript <<EOM
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal (first anchor of current pane whose name is "input")
end tell
EOM
else
alsamixer -c ${rec_hw:3:1} -V capture || read -p "ERROR: check above"
fi;;
Gain*) configure "gain";;
*duration*start*) configure "min_noise_duration_to_start";;
*perc*start*) configure "min_noise_perc_to_start";;
*duration*stop*) configure "min_silence_duration_to_stop";;
*level*stop*) configure "min_silence_level_to_stop";;
*) break;;
esac
done;;
"Voice recognition")
while true; do
options=("Recognition of magic word ($trigger_stt)"
"Recognition of commands ($command_stt)"
"Snowboy settings"
"Bing settings"
"Wit settings"
"PocketSphinx setting")
case "`dialog_menu 'Settings > Voice recognition' options[@]`" in
Recognition*magic*word*) configure "trigger_stt";;
Recognition*command*) configure "command_stt";;
Snowboy*)
while true; do
options=("Show trained hotwords/commands"
"Token ($snowboy_token)"
"Train a hotword/command"
"Sensitivity ($snowboy_sensitivity)")
case "`dialog_menu 'Settings > Voice recognition > Snowboy' options[@]`" in
Show*) IFS=','; dialog_msg "Models stored in stt_engines/snowboy/resources/:\n${snowboy_models[*]}";;
Sensitivity*) configure "snowboy_sensitivity";;
Token*) configure "snowboy_token";;
Train*) stt_sb_train "$(dialog_input "Hotword / Quick Command to (re-)train" "$trigger")" true;;
*) break;;
esac
done;;
Bing*)
while true; do
options=("Bing key ($bing_speech_api_key)")
case "`dialog_menu 'Settings > Voice recognition > Bing' options[@]`" in
Bing*key*) configure "bing_speech_api_key";;
*) break;;
esac
done;;
Wit*)
while true; do
options=("Wit key ($wit_server_access_token)")
case "`dialog_menu 'Settings > Voice recognition > Wit' options[@]`" in
Wit*) configure "wit_server_access_token";;
*) break;;
esac
done;;
PocketSphinx*)
while true; do
options=("PocketSphinx dictionary ($dictionary)"
"PocketSphinx language model ($language_model)"
"PocketSphinx logs ($pocketsphinxlog)")
case "`dialog_menu 'Settings > Voice recognition > PocketSphinx' options[@]`" in
PocketSphinx*dictionary*) configure "dictionary";;
PocketSphinx*model*) configure "language_model";;
PocketSphinx*logs*) configure "pocketsphinxlog";;
*) break;;
esac
done;;
*) break;;
esac
done;;
"Speech synthesis")
while true; do
options=("Speech engine ($tts_engine)" "OSX voice ($osx_say_voice)" "Cache folder ($tmp_folder)") #"Voxygen voice ($voxygen_voice)"
case "`dialog_menu 'Configuration > Speech synthesis' options[@]`" in
Speech*engine*) configure "tts_engine";;
#Voxygen*voice*) configure "voxygen_voice";;
OSX*voice*) configure "osx_say_voice";;
Cache*folder*) configure "tmp_folder";;
*) break;;
esac
done;;
"Step-by-step wizard")
wizard;;
*) break;;
esac
done
configure "save";;
Commands*)
editor jarvis-commands
#update_commands
;;
Events*)
dialog_msg <<EOM
WARNING: JARVIS currently uses Crontab to schedule monitoring & notifications
This will erase crontab entries you may already have, check with:
crontab -l
If you already have crontab rules defined, add them to JARVIS events:
crontab -l >> jarvis-events
Press [Ok] to start editing Event Rules
EOM
editor jarvis-events &&
crontab jarvis-events -i;;
Plugins*)
menu_store
;;
Help*)
dialog_msg <<EOM
A question?
http://domotiquefacile.fr/jarvis/content/support
A problem or enhancement request?
Create a ticket on GitHub
https://github.com/alexylem/jarvis/issues/new
Just want to discuss?
http://domotiquefacile.fr/jarvis/content/disqus
EOM
;;
"About") dialog_msg <<EOM
JARVIS
By Alexandre Mély
http://domotiquefacile.fr/jarvis
[email protected]
(I don't give support via email, please check Help)
You like Jarvis? consider making a 1€ donation:
http://domotiquefacile.fr/jarvis/content/credits
JARVIS is freely distributable under the terms of the MIT license.
EOM
;;
"Search for updates")
jv_check_updates
jv_update_config # apply config updates
jv_plugins_check_updates
;;
*) exit;;
esac
done
>>>>>>> origin/pr/478

0 comments on commit cda97ee

Please sign in to comment.