Making a menu-driven OS program launcher in python: With speech assistance
Have you ever wondered how to just talk to your computer and tell it to open the browser or play music for you? If yes, then this is the software for you.
We see Siri and Alexa everywhere today, ready to assist us with anything. If you are anything like me, you must have wondered how it actually works. There must be some complicated coding with some technical mumbo-jumbo behind it… Absolutely NOT! What a surprise. Just a few lines of code with some amazing modules can do the trick. Read on to find out how to make your own speech assisted programs. For this example, I have decided to make a simple program launcher for Windows Operating System.
This simple and intuitive code in python allows us to talk to our computer and tell it to keep our tabs ready. What a great help especially on not-so-great days. Whether it’s because of your jam packed schedule or simply because you’re feeling lazy, what a great way to get assistance for your laptops or computers.
I have started off by importing 3 libraries:
- os
- pyttsx3 (to convert text to speech)
- speech_recognition (to accept user’s input by them talking to the device)
It is followed by instructing the user to tell the device what needs to be done. As seen in the image, it is printed on the screen as well as said out loud by the device in the form of audio instruction.
Following this we accept the input from the user as the user talks back to the device. Then using a loop, the input is taken and the required action is performed. The output confirms the action as shown below.
The simple command os.system() was able to automate the launching of OS programs. This was my take on creating a menu-driven OS program launcher using python. Hope you enjoyed the article!
Keep learning, keep exploring and be joyful!