Wednesday, July 06, 2005

Python Speech API for Windows

Dapo has been working on this Java app that should read text out of a webpage, and my! Has he had issues with Java!

 

He’s gone from issue to issue, and he wishes he could have done it all in C# / .NET (He’s really our local .NET guru J ).

 

Anyway, I started feeling slightly jealous, and set out to see how hard it would be to achieve in Python. I hit my repository – AKA – Google J, and typed in Python Speech API.

 

There were myriads of  results. I picked the first one that happened to be a recipe from the Python Cookbook on ActiveState. : http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/93025

 

Well, the second link I checked out was a module called pyTTS, which is a thin layer atop Microsofts SAPI framework. : http://www.cs.unc.edu/~parente/tech/tr02.shtml

 

To say that I was shocked will be an understatement… this is what the code to read a line looks like with pyTTS:

 

#-----------start of code -------------#

import pyTTS

 

tts = pyTTS.Create()

tts.Speak(“Unbelievable right? But I’m speaking!”)

 

#------------uhh… end of code :D -------#

 

That’s it!!!

 

I called Dapo over, to look at the sample Python Code, and we all started laughing… I mean it was so simple it was absurd.

 

The point here, is not *JUST* that it is only three lines of code. The point is that I most python libraries feel the same way. They do most of the underground work for your Default Scenario (which you end up using 90% of the time), and if you still want to get raw access… be my guest… its always there. The CookBook recipe still shows that without pyTTS, I could still build something simple and very much Pythonic from scratch, in VERY LITTLE lines of code. Its definitely amazing to have this much power at your finger tips.

 

If there is one thing I’ve learnt from Python, it is the power in succinctness. IMOHO, any developer that is not harnessing this succinctness yet from any source, Perl, Python, Ruby, Groovy, etc, is really wasting valuable time on things that he/she doesn’t have to spend time on.

 

Now, this is not exactly running out of a web page (So its not exactly Dapo’s *Current* problem… but a Python Webapp, is same as a Python Desktop app, and I don’t have to battle Java Applets like he’s doing now… poor guy J )

 

Now, what’s the next cool thing I’ll do with this? Hehehe… I think ‘misctray’ is going to start reading my tutorials and reading materials for me J

 

 

 

 

0 Comments:

Post a Comment

<< Home