Vox etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Vox etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
10 Eylül 2015 Perşembe
How to use Vox for basic system function,remote VNC Raspberry Pi login and others ( Vox part 2 script)
This post show How to use Vox for controlling system basic function using voice recognition .It is a continuity from my previous post .At this moment, The program consist of 3 main script.There will be a more function added to this program in the future .
Script
1.vox (main script)
2.vrec (recording script. will use more for future development)
3.vsort ( return text integrate with local system script )
Script details
1.Vox script(main script)
1.1.Variable declaration and changing directory working directory to ~/vox-master .
URL="http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium&maxresults=10"
cd ~/vox-master
If you use different language than english, you need to change "en-us" in the above script..Check here for language reference. Notice the "&maxresults=10" line . What this line do is, it request for maximum 10 results from Google server.
1.2. Calling the recording program.
./vrec
Currently, the program can only record for 3 seconds .You can remove this line and just use " rec -r 16000 -b 16 voice.flac trim 0 3 " instead .The recorded file will be save as "voice.flac"
1.3 "voice.flac" will then be send over to Google voice search engine and it will feedback a text message to our system . The retrieve result from Google is then pipe into a file call "result" .I use "result" information to custom my "vsort"file .
wget -q -U "Ninetailfox" --post-file voice.flac --header "Content-Type: audio/x-flac; rate=16000" -O - "$URL" >result
The detail information of the above command is much more easier to understand with snapshot from Wireshark . Click here to download vox wireshark file .
![]() |
Vox Wireshark snapshot |
1.4 Sorting out the return result and send it over to "vsort" script. After vsort file being execute, The program will wait for 5 second delay before executing .
RETURN="$(cat result | cut -d\" -f12 )"
echo "you said :$RETURN"
./vsort "$RETURN"
sleep 5
2 Vrec script .
At this moment, Vrec only consist of one line .I'll be using this file more in the future development.
3.Vsort script
What this script does is it associate the word that has been retrieve from Google server and use it to execute a command that is associated with your system. You need to make sure what kind of word is use and what command you want to execute . You need to edit this file to make it work with your system.
In the existing script ,
case "$1" in
'ping server')
cd /home/shark_attack/Programming/bash
./pi -ping
;;
'ping server' is the word I choose and I want it to execute my "./pi" script in "/home/shark_attack/Programming/bash" . Click here to check my previous post on my pi script .
I will update more function on vox in the future . At the moment, I'm testing some other stuff and playing around with some code. That's it for now.Please leave comment on the box below .
Read Previous :How to use Voice for basic system control ,Raspberry pi remote VNC server login in Linux (Vox part1)
How to use Voice for basic system control function,Raspberry pi remote VNC server login etc (Vox install and use)
A few days ago I played around with Google voice search and wonder if Google has this good program that can detect voice and return their search result, I can use this function to make use on my system . Instead of writing big chunk program with dictionary stuff to do some basic voice recognition function,I can make use Google server voice recognition service to return the text and execute it on my system. Once I start to work around the script, I realize there is heaps of function I can integrate with this script. This can be a good program by itself.
In this post , I'm going to share how you can use Google voice recognition to do simple task with your system . The idea behind this program is using your recorded voice,send it to Google server and it will translate the voice to text . The translated text will be use as a control structure to run basic command for your system .
What do you need for this project?
1. Internet connection
2. Built in or external mic
3. Any Linux Distro (Bash shell)
5. A little bit of bash scripting knowledge
Steps
1. Download the source code zip file. Extract it on your "home" folder . Please click here
![]() |
Downloading Vox |
2.Run the "setup" file
shark_attack@Positive-Space:~$ cd vox-master
shark_attack@Positive-Space:~/vox-master$ sudo ./setup #installing Vox dependencies and run it
shark_attack@Positive-Space:~/vox-master$ sudo ./setup #installing Vox dependencies and run it
3.Set your keyboard shortcut .Open your keyboard setting . Since I'm running on Ubuntu 12.04 , below is snapshot how to do this. If you are running on different Linux Distro, you can try to look around in your system .
3.1. Search for Keyboard setting
![]() |
Search for Keyboard setting |
3.2 Click "Shortuct>Custom Shortcut" and click the '+' sign . Give it a name .You can use your own name if you want to :)
3.3 In the command box . add below command in the shortcut box
gnome-terminal -e /usr/local/bin/vox
![]() |
add new shortcut |
3.3 In the command box . add below command in the shortcut box
gnome-terminal -e /usr/local/bin/vox
![]() |
edit the command part |
3.4 Click on the right side and give it a shortcut that you want . In my case, I use "CTRL -M"
![]() |
choose your shortcut |
4. Edit "vsort" file to use it with your system setting.The voice recognition is not 100% accurate because of different dictation between people and how Google server feedback the result to our system.For that reason ,I save 10 utterance that being detected by Google in the "result" file . You can use the result uttterence word by editing in the "vsort" file .I will share the detail script drill down information in the next post .Stay tune .
5.Next test and play around with it. You can run it from the terminal or use the shortcut key you have set .
shark_attack@Positive-Space:~$ vox
The program should work with basic file searching using your own voice.This program is still under testing phase and I will update more function to vox.Anyone interested with this project or have cool idea what to include in are welcome to contribute.Please visit my Github page.
Read Previous :How to convert video file type with robot voice feedback using bash script on Linux
Read Next :How to use Vox for basic system control,remote VNC Raspberry Pi login and others (Vox part 2)
Kaydol:
Kayıtlar (Atom)