Sei sulla pagina 1di 7

Hardware

Components
Raspberry pi (At least model B)
SD Card (4GB at least)
USB Wall Charger Adapter(2A recomended)
USB-micro USB cable
USB wifi adapter
USB External Sound Card

Microphone (jack3.5)
Self Powered Speakers

Software
THE PROGRAM ITSELF IT'S
PUBLISHED HERE
Instalation
If you are running it on a raspberry pi, you need to install raspbian
First of all you must have python 2.7 installed on your computer. To check this
type python --version in the terminal. If it is not installed just google how to
install it on your linux distro.

Python tools
sudo apt-get install python-dev
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo pip install --upgrade pip

Required modules
To prevent errors, we're installing all the modules manually instead of using pip.
PyAudio to use the microphone

sudo apt-get install git


git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
cd pyaudio/
sudo python setup.py install

Pygame for playing sound/music


sudo apt-get install python-pygame

Wikipedia unofficial API


git clone https://github.com/goldsmith/Wikipedia.git
cd Wikipedia/
sudo python setup.py install

Wolframalpha API
sudo pip install wolframalpha

Tweepy for using twitter


git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install

running install
running bdist_egg
running egg_info
creating tweepy.egg-info
writing requirements to tweepy.egg-info/requires.txt
writing tweepy.egg-info/PKG-INFO
writing top-level names to tweepy.egg-info/top_level.txt
writing dependency_links to tweepy.egg-info/dependency_links.txt
writing manifest file 'tweepy.egg-info/SOURCES.txt'
reading manifest file 'tweepy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'tweepy.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/examples
copying examples/__init__.py -> build/lib.linux-x86_64-2.7/examples

copying examples/streaming.py -> build/lib.linux-x86_64-2.7/examples


copying examples/oauth.py -> build/lib.linux-x86_64-2.7/examples
creating build/lib.linux-x86_64-2.7/tweepy
copying tweepy/utils.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/binder.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/parsers.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/__init__.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/api.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/auth.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/streaming.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/cursor.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/error.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/cache.py -> build/lib.linux-x86_64-2.7/tweepy
copying tweepy/models.py -> build/lib.linux-x86_64-2.7/tweepy
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/examples
copying build/lib.linux-x86_64-2.7/examples/__init__.py -> build/bdist.linux-x86_64/egg/examples
copying build/lib.linux-x86_64-2.7/examples/streaming.py -> build/bdist.linuxx86_64/egg/examples
copying build/lib.linux-x86_64-2.7/examples/oauth.py -> build/bdist.linux-x86_64/egg/examples
creating build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/utils.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/binder.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/parsers.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/__init__.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/api.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/auth.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/streaming.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/cursor.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/error.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/cache.py -> build/bdist.linux-x86_64/egg/tweepy
copying build/lib.linux-x86_64-2.7/tweepy/models.py -> build/bdist.linux-x86_64/egg/tweepy
byte-compiling build/bdist.linux-x86_64/egg/examples/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/examples/streaming.py to streaming.pyc
byte-compiling build/bdist.linux-x86_64/egg/examples/oauth.py to oauth.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/binder.py to binder.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/parsers.py to parsers.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/api.py to api.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/auth.py to auth.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/streaming.py to streaming.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/cursor.py to cursor.pyc
byte-compiling build/bdist.linux-x86_64/egg/tweepy/error.py to error.pyc

byte-compiling build/bdist.linux-x86_64/egg/tweepy/cache.py to cache.pyc


byte-compiling build/bdist.linux-x86_64/egg/tweepy/models.py to models.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying tweepy.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/tweepy-3.3.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing tweepy-3.3.0-py2.7.egg
Copying tweepy-3.3.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding tweepy 3.3.0 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/tweepy-3.3.0-py2.7.egg
Processing dependencies for tweepy==3.3.0
Searching for six>=1.7.3
Reading https://pypi.python.org/simple/six/
Best match: six 1.9.0
Downloading https://pypi.python.org/packages/source/s/six/six1.9.0.tar.gz#md5=476881ef4012262dfc8adc645ee786c4
Processing six-1.9.0.tar.gz
Writing /tmp/easy_install-D3vbm2/six-1.9.0/setup.cfg
Running six-1.9.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-D3vbm2/six-1.9.0/egg-disttmp-FNJKr2
no previously-included directories found matching 'documentation/_build'
zip_safe flag not set; analyzing archive contents...
six: module references __path__
Removing six 1.5.2 from easy-install.pth file
Adding six 1.5.2 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/six-1.5.2-py2.7.egg
error: Could not find required distribution six>=1.7.3

six debe ser mayor a 1.7.3???????????


VOLVI A EJECUTAR EL COMANDO PERO CON
SUDO Y DESPUES SIN SUDO Y DESAPARECIO
EL PROBLEMA

Goslate as a translator (google)


sudo pip install goslate

Pushbullet as Notificacion Service


sudo pip install pushbullet.py

TTS
Google TTS (Online) For google tts we use a bash script, and we mpg123 and
mplayer.
sudo apt-get install mpg123
sudo apt-get install mplayer

Pyttsx fork (Offline)


git clone https://github.com/parente/pyttsx.git
cd pyttsx
sudo python setup.py install

Festival (Offline)
sudo apt-get install festival festvox-don

STT
SpeechRecognition as stt (speech to text)
git clone https://github.com/Uberi/speech_recognition.git
cd speech_recognition
sudo python setup.py install

Flac to use google stt


sudo apt-get install flac

GPIO
RPi.GPIO for using the Button to stop/play music
wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz
tar -xzvf RPi.GPIO-0.5.11.tar.gz
cd RPi.GPIO-0.5.11
sudo python setup.py install

Configuration
USB Sound Card
If youre using a raspberry youll need to set up usb sound card: Connect it to
the USB port, and check if its recognized:
lsusb

If you see a Audio Adapter or something like this, its fine. Now we need to set
this as the main soundcard, so we open alsa-base.conf
sudo nano /etc/modprobe.d/alsa-base.conf

Change the following line:


options snd-usb-audio index=-2

To this:
options snd-usb-audio index=0
options snd_bcm2835 index=1

Reboot the raspberry sudo reboot After this, we need to adjust the volume, so
open alsamixer:
alsamixer

Adjust the speaker and mic volume with left/right and up/down keys, press esc,
and to save it:
sudo alsactl store

Next, test that recording and playing audio works well:


arecord temp.wav
aplay -D hw:1,0 temp.wav

Once that this works, we can download and setup the program itself.

Setup the program


First of all, open the profile.py file to configure the different options.

Name
The name you want it to have, for automatic recognition

TTS
You can choose between FESTIVAL, GOOGLE or PYTTSX (You have to write them
like this)

Auto recognition - True or False.


If it's False it will only recognize when you are pushing the button, and you won't
need to say the name. Otherwise it'll recognize when it hears the name and play
a beep sound.

Language
Actually it just works on Spanish as you have to translate the modules and the
brain. I've given up with this project, but you can fork it and translate it.

wolfram_api
You'll have to get your own API at http://products.wolframalpha.com/api/

notification_service - PUSHBULLET or PUSHETTA


You'll need to get a API for the service you choose. Just google for that.

Music
For listening to your music you have to put all your mp3 files at a folder called
"music"

Calibrate the microphone


Just open intensity.py in the room where VAOS is going to be. The room should
be quiet when you open the program. It'll return the average of mic's intensity
levels: Average audio intensity is 290.338523211 In this example, we take
some more values and if they're similar.
sudo nano stt/auto_recorder.py
Searh for the line wich says THRESHOLD and change it to 310, for example, in this case.

You have to choose a slightly higher value than the one returned by the script.

Potrebbero piacerti anche