These days while I was working on speech recognition with my friend, I came across a simple solution naming voice-commands which can be used to communicate with ubuntu system using speech recognition. It detects keywords accurately and supports many languages like English, Hindi, Bengali, Punjabi etc. I found this very useful and that’s why writing a tutorial on how to use voice-commands on ubuntu system.
Step 1: Open terminal using Ctrl+Alt+T , and type the following:
sudo add-apt-repository ppa:baitsart/voice-commands
sudo apt-get update
sudo apt-get install voice-commands
Step 2: This will install voice-commands in your system, and you can now test it using the following commands (try any one of the commands shown below).
This will start recording the voice and after little processing it will display the recognized word or string. In order to set the mic, use v-c -m and set the volume level according to your requirements in system’s microphone settings.
Follow the instructions below, if microphone related issues are there:
Active, and correct volume Microphone, Check: System Settings, Sound, Internal microphone, to Microphone.
You can modify the microphone port, of the command that activates microphone, and again to internal microphone, the default port is 1, if you have that recognition is not done, you can modify by command with:
« v-c -mic ‘1, 2,…’ »
and, if is Microphone / Microphone ‘1, 2,…’, then will be:
« v-c -mic ‘1, 2,…’ input-‘1, 2,…’ »
« v-c -mic ‘1, 2,…’ input-‘ ‘ » [ empty for ‘reset’ to no “;input-” ]
And if by errors of machine translation, has commands some misspelled or repeated, must modify also, can doit with the command:
v-c -m, or, v-c -mod
voice-commands has some default speech command actions like:
SELECT_FILE << cited-text >> (select)
MUSIC_START (put music | music play | music player | music | pause)
MUSIC_START_SONG << cited-text >> (put music of | music of | play to | play music of)
MUSIC_PLAY (play music | pause music | start music | stop music | stop music)
MUSIC_NEXT (next song | next track)
MUSIC_PREV (previous song | previous track)
MUSIC_SHUFFLE (random music | mix | do not mix)
MUSIC_REPEAT (repeat | not repeat)
VIDEO_REW (delay | rewind | go back)
VIDEO_FF (forward | go forward)
VOLUME_DOWN (lower the volume | volume down | less volume | volume less)
VOLUME_UP (increase the volume | volume up | more volume | volume more)
VOLUME_MUTE (no audio | no volume | turn off audio | dumb)
SEARCH << cited-text >> (search)
NO_RESALT (remove highlighting | remove highlighted | no highlighting | no highlighted)
TRANSLATE [from] [to] << cited-text >> (translate | translates the | translation | translates of | translate from | translated from | translation from | dictionary of the | translates the | translation of the)
WRITE << cited-text >> (write | type)
WRITE_CAPITAL << cited-text >> (capitalize | type capital)
WRITE_CAPITAL_ALL << cited-text >> (write all uppercase | write everything capitalized)
SAY_THIS << cited-text >> (say this | say)
GOOGLE_SEARCH << cited-text >> (search google | internet search | meaning of | what is | search the dictionary)
YOUTUBE_SEARCH << cited-text >> (search on youtube | what about | search videos | videos )
WIKI_SEARCH << cited-text >> (search wiki | search wikipedia | wikipedia)
WEATHER << cited-text >> (weather | climate)
SEARCH_MAPS << cited-text >> (map | map search | map of | map from | where is)
SAY_HI << cited-text >> (greets to | say hi to)
HELLO (hello machine)
WHOAMI (who i am)
OPEN_FOLDER << cited-text >> (open folder)
OPEN_FOLDER_OF << cited-text >> (open folder of)
SAY_TIME (tell me the hour | what the time is | what time is it)
SAY_DATE (date is | which day is | that date today | which day is today | tell me the date | on what date we are)
DICTATION << cited-text-continuously >> (dictation mode | out dictation mode | end dictation mode)
DEL_LINE (delete line)
FAV (add to favorite)
CLOSE_TERM (close the terminal | close terminal)
MAIL (open mail | open email | open mail | mail | email)
SELECT_ALL (select all)
SAVE (save | save file)
SAVE_AS (save as | save page as)
FOLDER (create folder | new folder)
FULLSCREEN (full screen | fullscreen)
TAB (key tab | tabulation | tab)
MENU (main menu | open main menu)
ACTIONS_MENU (menu | open menu | close menu)
CLOSE (close program | exit)
CLOSE_WIN (close window)
ZOOM_OUT (ward | shrink | decrease | zoom less)
ZOOM_IN (approximate | enlarge | raise | zoom more)
ZOOM_RESET (normal size | zero zoom)
TOUCH_ON_OFF (turn off touchpad | turn on touchpad | touchpad)
BACK (over | back)
ADVANCE (move | forward)
UP (go up)
PAGE_DOWN (page down)
PAGE_UP (page up)
HOME_PAGE (top of page | go to top of page | go to the top)
END_PAGE (end of page | go to end of page | go to the end)
HOME (top of)
END (the end)
SCROLL_DOWN (run page down | run down)
SCROLL_UP (run page up | run up)
ENTER (open | execute | enter)
NEW_WINDOW (new window)
CHANGE_TAB (window move | go to window | switch to window | window | move tab | go to tab | switch to tab)
CLOSE_TAB (close tab)
BROWSER (browser | open browser | internet)
FILE_MANAGER (nautilus | file explorer | open nautilus | open file explorer)
TERMINAL (open the console | open terminal | terminal opens | open the terminal)
EXECUTE (launch command | run command)
BATTERY (battery | battery status | battery charge)
TEXT_EDITOR (text editor | open text editor | launch text editor | new text)
SCREENSHOT (screenshot | catch)
ALARM << cited-numbers [days] [hours] [minutes] [seconds]>> (alarm | start alarm at)
LOG_OFF (logout | system logout)
BRIGHTNESS_UP (raise the brightness | brighten up | shine up | up brightness | increase brightness)
BRIGHTNESS_DOWN (lower the brightness | decrease brightness | brightness down | shine down | decrease brightness)
POWER_OFF (shut down the system | turn off the machine | turn off the computer | turn off computer | power off)
TAKE_PICTURE (photo | take a picture)
TAKE_VIDEO (record | record video | record a video)
OPEN_FILE (open file | open a new file)
OFFICE << cited-text [ writer, calc, impress, draw, math ] >> (open new document | open new document of | create new document | create new document of | create new | open new) Writer (text) Calc (calc) Impress (presentation | page | web) Draw (drawing | graphic) Math (formula | math)
RETRY (retry command | repeat command | try again the command | retry | try again)
In addition to the above keywords, we can add our own keywords and assign a script to each voice command.
Step 1: Open terminal, and type the following command in it.
v-c -a add
This will open a window somewhat similar to the one shown below.
Step 2: Add the name for the script, and the strings through which it can be called as shown below.
Here, OPEN_FIREFOX is a name given for the script naming purpose, it should not match with the scripts already there in voice-commands.
open firefox, firefox, start firefox are the method or keywords through which the script can be called for opening firefox.
(Note: all the keywords must be separated by ‘\|’)
Now, this means that whenever someone will say “open firefox” or “firefox” or “start firefox”, the system will trigger a script which will execute the commands written in the script.
Step 3: Now, after the above step is finished, click Create which will open a bash script. At the end of the file, add the commands to be executed when above mentioned keywords are detected. For instance, see below.
Here, I added firefox -new-tab ‘https://www.installthetech.com’ command which will be executed when the keywords are detected. This will open a new tab in firefox browser and direct it to ‘www.installthetech.com’.
Save and close the bash script file.
Step 4: From the dialog box, select one of the choice according to your convenience, and you are done. Test the command by typing “v-c” in the terminal and saying any of the above mentioned keywords.
Step 5(Optional): We can also create a keyboard shortcut for voice commands as follows:
Open “keyboard” from settings. Go to “Shortcuts” -> “Custom shortcuts”. Click “+” on the bottom and this will open a window as follows.
Click Apply, and this will add a shortcut on the panel. To add shortcut keys, choose the row of the new shortcut, click “Disabled” and when it changes to “New accelerator…” press the combination of keys for calling Voice commands (In my case, I chose Fn+F7). This will create a keyboard shortcut, and next time when you will press the shortcut keys, voice-commands will run automatically.
Hope you do good with voice-commands.