What is it?Harnessing Google Translate API and combining it with some simple Python Code and mPlayer, you can creating a speaking Raspberry Pi. With a few tweaks this setup can be adapted to create a simple Chat-bot or even a system that retrieves and reads out the weather forecast for you.
Getting startedThe first step in creating a speaking Raspberry Pi is to update your OS software and install the mPlayer, a free open source media player. Ensure you are connected to the Internet.
In the LX Terminal type: sudo apt-get update When this completes type: sudo apt-get install mplayer That is it! Once installed restart the Pi and you are ready to make the Pi speak. Connect the speakers via the audio port and download the simple python code below. This code uses the Google translate API to process the text into speech, once completed it returns the 'words'. The Python code uses a a simple function called raspberryTalk to enable the typed words to be converted and spoken. You can change the text or add your own using raspberryTalk function. The program only runs once so you could add a loop function to enable continuous talking?
Pump up the Volume!If there is no sound playing then check the speaker connection. The volume on the Pi may also be set too low.
In the LX Terminal type: alsamixer This will enable you to adjust the volume by pressing the up and down arrow keys. |
Building a Chat botStudents and many adults are fascinated by Chatbots. Using simple loops and if, elif, else statements the code can be modified to create simple chat-bot. Challenge students to create the most realistic Chatbot they can and use the Turing Test to compare them and pick an overall winner.
Download Chatbot Code HereA basic modification of the previous code to get you started with a Chat-bot.
Weather Bot:This simple project combines a simple Parser that pulls down weather reports from Yahoo. Then raspberryTalk announces the weather for the location that the weather has been set to. To get started update the Pi and install the Parser.
In the LX Terminal type: sudo apt-get install python-feedparser Once installed download the program below to get started. This returns a set of weather data for London.
The original Raspberry Pi weather project is available here. It shows you how to change the location of the weather report and how to customise what weather data is returned and reported.
The Twitter Bot: click here |
- Home
- Python
- Ras Pi
-
Pi Hardware
- Pi-Hacks
-
Pi-Hacks 2
- The Joker
- Hologram Machine
- Google Vision: Camera Tell
- Yoda Tweets
- Pi Phone
- Darth Beats
- Twitter Keyword Finder
- Crimbo Lights Hack
- Xmas Elf
- Halloween 2016
- Halloween Hack 2015
- Socrative Zombie
- Voice Translation
- The Blue-Who Finder
- GPIO, Twitter
- Pi Chat Bot >
- PiGlow & Email
- Pibrella Alarm System
- SMS with Python >
- Pi-Hacks 3
- Minecraft
- Computing
- Contact Me
- Random Hacks