Turns out speech recognition and making a computer talk aren’t so hard

I am still polishing the code, but I got a lot farther than I imagined I could in so little time, I’m just impressed with Python, it’s making my life so much easier. Matilda now not only can “understand” what I am saying but can also talk back, all of this with only a few lines of code, thanks Python, why did I not give you a chance before?!

At this point she’s not doing much, but she’s already able to tell me about the weather when asked and when I give a command she’s not familiar with (which is pretty much anything but asking about the weather), she repeats what I said.

Here’s what I got so far:

Architecture wise, I am guessing Matilda will have several micro-services interchanging data and executing commands individually, but I haven’t actually taken any action towards getting this done, as I said, I’m still polishing the code, but it is available here:

Speech Recognition is still terribly slow for some reason, I still have to figure out why, so that’s what I will be working on over the next few days. Also this will not work outside Ubuntu, as I am using Ubuntu’s text-to-speech library “spd-say”, but most operational systems have its own, so should you want to play with the code, it would just be a matter of figuring out which command runs your OS’ library and change the code appropriately. Or else you can just run it on Docker.

I also changed Matilda’s hardware slightly to what I had previously described, I bought an Orange Pi, which is a cheaper alternative to Raspberry Pi. Check it out:

As per usual, I bought it on AliExpress and it will take ages to arrive, but will be worth the wait. What that means is that I can have the little snippet above running on my living room and I can get weather updates anytime I want. Though hopefully I’ll have found more meaningful functionalities and polished it a lot more lol.

So far, building Matilda has been a lot of fun and has given me a good overview of Python, I hope the code above helps someone, I also created a github profile (which is empty as of now), to better share the codes I write for Matilda.



Add a Comment

Your email address will not be published. Required fields are marked *