top of page

This page takes you through all the steps needed to build a language translator 


Assuming that you already have an already booted up raspberry pi, 
So let's get started

 It is recommended to update Raspbian distribution first 
sudo apt-get update sudo apt-get upgrade 

 

If you already don’t have sound on your RPi then you will need the alsa sound utilities:

sudo apt-get install alsa-utils 
 and edit the file /etc/modules using : 
sudo nano /etc/modules 
to have line: 
snd_bcm2835 
If this line is already present, then leave the file as is! Install the mplayer audio/movie player with: 
sudo apt-get install mplayer 
To sort out the mplayer error message, edit file /etc/mplayer/mplayer.conf using: 
sudo nano /etc/mplayer/mplayer.conf 
to add line: 
nolirc=yes 
 
Install Espeak with 
sudo apt-get install espeak 

 Install the FLAC Codec that is not included in the standard Raspian image 
sudo apt-get install flac 

 

Install sox using: 
sudo apt install sox 
 
Install the following python packages using pip: 
sudo pip install SpeechRecognition 
To register your application with Azure DataMarket, visit https://datamarket.azure.com/developer/applications/ using the LiveID credentials, and click on “Register”. In the “Register your application” dialog box, you can define your own Client ID and Name. The redirect URI is not used for the Microsoft Translator API. However, the redirect URI field is a mandatory field, and you must provide a URI to obtain the access code. A description is optional. 
Take a note of the client ID and the client secret value. 
Then install this python package: 

sudo pip install microsofttranslator 
 
 
Once you have installed all of the above necessary packages, it is advised to reboot your Pi (rebooting helps your Pi to apply the new configurations) 
 
The entire code for the project can be found at:  https://github.com/harshasridhar/translateText Now you will have to clone the git repository to your raspberry pi 

git clone https://github.com/harshasridhar/translateText.git 
 
Once you have cloned the repository, now you will have to change your current directory to the cloned folder 
cd translateText 
 
To run the complete program, you will have to run the tts.sh shell script but before running the script, it has to be made executable 
chmod 764 tts.sh 
 
Before running the shell script make sure that you have provided your Microsoft translate api credentials in the MSTranslate.py file Edit the following line  translator=Translator('''client id''','''client secret key''') Replace the '''client id''' with your client id and '''client secret key''' with your client secret key which can be found on this page  https://datamarket.azure.com/developer/applications/ it can be found under the registered applications, click edit on your registered client to reveal the client id and the secret key 
 
Once all this is done, the program can be executed using the following command 

./tts.sh 
 

Instructions

bottom of page