Crate bmos_client[][src]

Expand description


bmOS_client is an executable in charge of receiving and parsing JSON input from stdin and sending intents with enough confidence (>0.6) to the address and port provided (to bmOS_server)

Expected input

bmOS_client expects JSON strings with the format specified here, and looks for the intent’s name and confidence, sending it if the confidence’s enough.


  • bmOS_client is dumb. It will not check whether the intent it’s sending is correctly defined in bmOS_server, so sending undefined intents will result in a panic in the target.
  • bmOS_client will panic if the server is unavailable upon sending an intent, or if the input it receives does not conform to the JSON input it expects. There are no attempts on recovering lost connections.
  • bmOS_server needs to be running and listening for new connections before bmOS_client starts.

Everything is designed around voice2json as the source of intent recognition. The documentation is available here. The best results have been obtained with the default profiles, both in English and Spanish, though one should expect a moderate amount of false positives if the environment is noisy. Below is an example of a barebones sentences.ini file (which is the only modification I did on the downloaded profiles):

hi beemo
hello beemo

play a song beemo

you are ugly beemo

i hate you beemo

surprise beemo

start a chronometer beemo
give me a chronometer beemo

give it (five | 5) minutes more

give it (ten | 10) minutes more

give it (twenty | 20) minutes more

take (five | 5) minutes less

take (ten | 10) minutes less

take (twenty | 20) minutes less

it is done beemo
i have finished beemo

Below is an example of a bash script which sets up audio streaming from bmOS_server’s host, receives it on the local host running bmOS_client and pipes it through voice2json up to stdout (which should then be piped to bmOS_client)

ssh pi@[ip_address_here] "rec -c 2 -t wav -" | sox - -d -t raw -r 22.05k -b 8 - gain -5 | sudo ./voice2json.bash --profile /profile/ transcribe-stream --audio-source - | sudo ./voice2json.bash --profile /profile/ recognize-intent

Where voice2json.bash contains a script to fire up voice2json’s docker container, where en-us_kaldi-zamia is the name of the profile used, and should be changed to whichever is in use:

docker run -i \
     --init \
     -v "[path_to_local_dir]/voice2json/profile:/profile/" \
     -v "[path_to_local_dir]/voice2json/profile:/root/.local/share/voice2json/en-us_kaldi-zamia/" \
     -w "$(pwd)" \
     -e "HOME=${HOME}" \
     synesthesiam/voice2json "$@"


Returns a tuple consisting of the intent’s name and its confidence, extracted from the provided json line.