Raspberry Pi – Text to Speech

Just a quick note on Speech Synthesis a Raspberry Pi project. I had to research some of the options on the Raspberry Pi while looking into a project where I need some audio announcements.

Configuring Sound

echo 'snd-bcm2835' >> /etc/modules
sudo modprobe snd-bcm2835

sudo apt-get install mplayer alsa-base alsa-utils pulseaudio mpg123
# make mplayer use mpg123 codec instead of default ffmp3float
echo "afm=mp3lib" >> ~/.mplayer/config

Since I am using Raspbian which is a Debian based (Wheezy) Distribution I used some Ubuntu documentation (https://help.ubuntu.com/community/TextToSpeech) as the starting point.

Festival

sudo apt-get install festival festival-english
echo "Hello World - Testing" | festival --tts

Plus: Local install (no internet connection required)
Minus: Mechanical sounding voice

Espeak

sudo apt-get install espeak
espeak -v en "Hello World - Testing"

Plus: Local install (no internet connection required)
Minus: Mechanical sounding voice (slightly better than Festival)

Google Translate

Create a shell script tts.sh
#!/bin/bash
mplayer -ao alsa -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*" > /dev/null 2>&1

chmot +x tts.sh
./tts.sh "Hello World - Testing"

Plus: needs live internet connection
Minus: excellent human sounding voice

Google Speech API

I will most likely look at this in the long run to get better control rather than calling the Google Translate url too much.

Enable GeoIP lookups on CentOS

GeoIP enables you to identify the location, organization, connection speed, and user type of your website visitors.

yum install GeoIP mod_geoip
cd /usr/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
rm -f *.gz

Edit the VirtualHost settings in httpd.conf

<ifmodule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/share/GeoIP/GeoLiteCity.dat Standard
</ifmodule>

Restart Apache

/etc/init.d/httpd restart

Accessing Amazon RDS from Desktop

Every once in a while it is handy to be able to access an Amazon RDS Database Instance remotely from a desktop.

ssh -i YOUR-AMAZON-PRIVATE-KEY.pem -l YOUR-AMAZON-RDS-USERNAME -L 33060:YOUR-AMAZON-RDS-PRIVATE-IPADDRESS:3306 -N ec2-usr@YOUR-AMAZON-EC2-INSTANCE-PUBLIC-ADDRESS

Note: YOURAMAZONRDSPRIVATEIPADDRESS needs to be the AWS internal RDS IP Address – not the external hostname

You can then connect to RDS using mysql commands or any GUI tool such as MySQL Workbench via localhost:33060

Thanks to: Dirk Taggesell via AWS Forums

Installing the latest stable version of LibreCAD on Ubuntu

I have recently been looking at different CAD options on Ubuntu and LibreCAD (http://librecad.org/) is looking like the best option for my needs at current (apart from the wish there would be some DWG support).

Since the main Ubuntu repositories are usually a fair bit behind the lastest stable realeases of LibreCAD you need to add the LibreCAD Dev PPA Repository

sudo add-apt-repository ppa:librecad-dev/librecad-stable
sudo apt-get update
sudo apt-get install librecad

Mobile Browser Testing on the Desktop

If you need to check websites for mobile compliance on a regular basis you know that having a device to constantly check is painful and slows down your work during debugging and phases of constant change.

Surrounding myself with screens by adactio, on Flickr
Creative Commons Attribution 2.0 Generic License  by  adactio 

There are a few tools that will make this work a lot easier:

Google Chrome

Chrome does have some nice dedicated plug-ins to help with this task

Firefox

I am not aware of any plug-ins like Chrome, but as a hack I have found it useful to employ a user-agent switching plugin to trick the browser

User Agent Switcher (http://chrispederick.com/work/user-agent-switcher/) works well for this.

  1. Download the User Agent Switcher Add-on for Firefox
  2. Restart Firefox for the add-on change to take place.
  3. To start a new browsing session using an emulated browser, go to Tools > User Agent Switcher and select the appropriate mobile web browser you want to emulate
  4. To switch back to normal browsing, just select the default option from the above menu.

If you need more specific UA Strings check here: http://www.zytrax.com/tech/web/mobile_ids.html

For more serious work there are obviously dedicated emulators from the major Mobile OS vendors (but they need to be installed and configured for each platform):

 

PS: Nothing substitutes final QA testing on actual devices …

 

BESPIN – another nice one from Mozilla.org

Getting excited about a new text editor of all things is not something I like to admit to easily, but in my line of work (although less and less is actually doing hands on coding) text editing is an important part.

That’s why I checked out the BESPIN project as soon as I heard of it. The prospect of being able to edit your files from anywhere is very appealing to me since I spend a lot of time away from the desk and on devices that not always have good text editor (let alone all the files necessary). The thought of being able to edit files from a netbook while on the run is coming to mind straight away.

So far (even though this is a 0.1 ‘techo-preview’) I really like what you see. Not something that the average word processor crowd would find appealing or easy to use, but for somebody that is familiar with (specially *NIX) text editors it is easy to pick up and I can definitely see lots of potential there.

Bespin Dashboard
Bespin Dashboard
Editor Interface
Editor Interface

There are some important features still missing to make it truly useful in practical conditions, but I am sure they will be addressed in future revisions and it should be fairly easy to host your own since it’s basically Javascript & HTML5 and an Open Source project.

Great work by these guys:

Keep it coming ! Soon …

Mobile 2D codes gathering pace (outside of Asia)

FINALLY !!! As somebody that has been experimenting with this technology for over 2 years now I am quite exited to see that the adoption of this technology is gathering some steem. While it has bee widely adopted in Asia for some years now, it has taken some time to get a foothold in the rest of the world this seems to be changing now. At least in Europe as I can see for myself at the moment. In my opinion with Nokia finally getting serious and throwing its (considerable) weight behind this technology (http://mobilecodes.nokia.com/) and some other industry heavyweights joining forces in the Mobile Codes Consortium.� This will hopefully produce one key outcome, the stadardisation of the label technology, which up to now has been one of the stumbling blocks that has kept people such as myself from adopting these codes in real-world projects. Along with the adoption by some major companies in their advertising this should produce the momentum that was needed to push mobile 2D codes into some broad adoption.

Of course there is similar technology available for the applications that require this link between the physical world (presence) and the mobile internet. One example is RFID together with Near Field Communications (NFC). However apart from the additional expense for RFID labels, no other technology has anywhere close the number of handsets that are capable of using this technology without some add-on to the mobile phone. Currently there are only very few handsets that will support this technology. Possible use in m-Payment projects might speed up the process of handset manufacturers including this in their handsets, but that will be some way off. 2D codes are here and now.

datamatrix

Looks like I will dig out some of the pilot projects out of my (virtual) drawers and see if we can get some interest in them. The project that will most likely be the first is a m-Learning implementation using 2D codes together with the Moodle Learning Managment System which is our preferred LMS.

Let’s see if Australia is also ready to move on this technology ….