How can i write a code in raspberry that recognizes what user is saying, if he i
ID: 3579649 • Letter: H
Question
How can i write a code in raspberry that recognizes what user is saying, if he is talking to someone nothing happens, if he says "help" the system analyses voice and does speech analysis, and understands that the person needs help and automatically gets his gps coordinates and sends to his parents for exampleWould anyone please help??? Or have any idea about these kinds of codes ??? How can i write a code in raspberry that recognizes what user is saying, if he is talking to someone nothing happens, if he says "help" the system analyses voice and does speech analysis, and understands that the person needs help and automatically gets his gps coordinates and sends to his parents for example
Would anyone please help??? Or have any idea about these kinds of codes ???
Would anyone please help??? Or have any idea about these kinds of codes ???
Explanation / Answer
###Hi, here have used language - 'Python' to configure the device; symbol '#' or '#' is used as 'comments' here.
The initial step to set up the device -
We also need to set up the harware to start recording.
We also habe to set the usb-card in preference to any other built-in audio.
After plugging in the usb headset and also power on the Raspberry, we can set usb as default audio, by editing the alsa-base.config file as - ###
sudo nano /etc/modprobe.d/alsa-base.conf
set usb-audio index =0
# and add the line
snd_bcm2835 index=1.
#Then reboot the Raspberry.
#To get the required packages,
sudo apt-get install libasound2-dev autoconf libtool bison
swig python-dev python-pyaudio
#To install python libraries, use below -
curl -0 https://bootsrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install gevent grequests
============================
#If we get disconnected, then we can reconnect using -
git clone git://github.com/cmusphinx/sphinxbase.git
cd sphinxbase
git checkout 3b34d87
./autogen.sh
make
#install
sudo make install
cd ..
#To install pocketsphinx,
git clone git://github.com/cmusphinx/pocketsphinx.git
cd pocketsphinx
git checkout 4e4e607
./autogen.sh
make
#install
sudo make install
cd ..
# For testing the speech recording -
pocketsphinx_continous -inmic => yes
#If any warnings, we can ignore it and wait for the 'READY' prompt to appear.
#it will doa a search and display, once ready the message 'Ready' is displayed
READY...
#Firstly we also need to initialize the decoder.
#use the below code
config = decoder.default_config()
config.set_string('-help', help) # as stated in the question, with the test 'help'
config.set_string('-dict',dic)
config.set_string('-jsgf', grammar)
#the basic process can be distilled down -
#Satart an 'utterance'
decoder.start_utt()
decoder.process_raw(soundBite, False, False) # process the soundbite
decoder.end_utt()# end
hypothesis = decoder.hyp()
#retriev hypothesis
bestGuess = hypothesis.hypstr
#print that was heard - print'me heard you say :"{Help}" '.format(bestGuess)
###To send the message to the Parents and to initailize a resultant action from them, we can configure the device in such a way as after printing the message in the console, a high priority mail be sent to the Parents, with the text printed in the onsole in it. Being a high priority mail, a beep sound option, if configured in the mailbox, would alert them. Checking the mail, will help them initiate proper action f or the audio file - 'Help', as stated. ###
Please let me know if any clarification.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.