Voice Assistant

Share your love

Introduction to “alpha” – Your Personal Voice Assistant. Imagine having a knowledgeable and attentive companion at your beck and call, ready to assist with a wide range of tasks and provide information at your command. Meet “alpha0698,” your very own voice-controlled virtual assistant!

Alpha is a cutting-edge voice assistant designed to make your daily life easier and more enjoyable. With the power of voice recognition and intelligent responses, it’s like having a personal assistant right in your computer or device.

  1. Importing Libraries:
    • The script starts by importing necessary libraries such as speech_recognition, pyttsx3, webbrowser, datetime, pyjokes, os, requests, BeautifulSoup, wikipedia, and pywhatkit.
  2. Listening and Recognizing Commands:
    • The sptext function uses the speech_recognition library to capture audio input from a microphone and then recognizes the speech using Google’s speech recognition service. If the input is recognized, it returns the text data.
  3. Text-to-Speech Conversion:
    • The speechtx function uses the pyttsx3 library to convert text to speech. It initializes a text-to-speech engine, sets properties like voice and rate, and then speaks the given text.
  4. Initial Greeting:
    • The virtual assistant greets the user with the message “hello! This is alpha! What is the password?” and waits for a response.
  5. Main Loop:
    • If the user responds with “hello alpha,” the assistant acknowledges and enters a loop to listen for further commands.
  6. Command Handling:
    • Within the loop, the assistant listens for various commands and responds accordingly. Some of the recognized commands include:
      • Greetings like “hello,” “how are you,” and responses like “I am fine.”
      • Providing information about itself.
      • Reporting the time and date.
      • Telling jokes.
      • Providing weather information (based on a Google search).
      • Opening YouTube videos (using both webbrowser and pywhatkit).
      • Opening the ChatGPT website.
      • Playing songs from a specified directory.
      • Searching and summarizing information from Wikipedia.
      • Conducting Google searches and providing summarized results.
      • Exiting the assistant.
  7. Password Protection:
    • If the initial password “hello alpha” is not recognized, the assistant responds with “Wrong Password.”
import speech_recognition as sr
import pyttsx3
import webbrowser
import datetime
import pyjokes
import os
import requests
from bs4 import  BeautifulSoup 
import wikipedia
import pywhatkit
def sptext():
    recognizer=sr.Recognizer()
    with sr.Microphone()as source:
        print("Listening...")
        recognizer.adjust_for_ambient_noise(source)
        audio=recognizer.listen(source)
        try:
            print("recognizing...")
            data=recognizer.recognize_google(audio)
            print(data)
            return data 
        except sr.UnknownValueError:
            print("Not Understand")
            speechtx('Not understand')

            
def speechtx(x):
    engine=pyttsx3.init()
    voices=engine.getProperty('voices')
    engine.setProperty('voice',voices[1].id)
    rate=engine.getProperty('rate')
    engine.setProperty('rate',150)
    engine.say(x)
    engine.runAndWait()   
    
speechtx('hello!this is alpha! What is the password?')
        
if __name__=='__main__':
    while True:
        if "hello alpha" in sptext().lower():
            speechtx('got it ! How can i help you? ')
            while True:
                data1=sptext().lower()
                
                if "hello" in data1:
                    hello="Hello sir, how are you?"
                    speechtx(hello)
                elif "yourself" in data1:
                    tell="hi! I am you voice assistant,  my name is alpha0698,  i am here to assist you"
                    speechtx(tell)
                elif "are you doing" in data1:
                    doing="Nothing sir, i am waiting for your command"
                    speechtx(doing)
                elif "where are you" in data1:
                    where=" So, turn left from the paanwala and then go straight till you see a Banyan tree. Just kidding, ha ha ha ha, i live in the jupyter Notebook."
                    speechtx(where)
                elif "morning" in data1:
                    morning="Very Good Morning sir"
                    speechtx(morning)
                elif " afternoon" in data1:
                    afternoon="Very Good afternoon sir"
                    speechtx(afternoon)
                elif " evening" in data1:
                    e="Very Good Evening Sir"
                    speechtx(e)
                elif "i am fine" in data1:
                    fine="that's great sir"
                    speechtx(fine)
                elif "how are you" in data1:
                    perfect="Perfect sir"
                    speechtx(perfect)
                elif "thank you" in data1:
                    thank="you are welcome sir"
                    speechtx(thank)
                elif "name" in data1:
                    name="my name is alpha"
                    speechtx(name)
                elif "old are you" in data1:
                    age="i was launched in few days ago, so technically i'm pretty young."
                    speechtx(age)
                elif "temperature" in data1:
                    search="temperature in Bhubaneswar"
                    url=f"https://www.google.com/search?q={search}"
                    recognizer=requests.get(url)
                    data=BeautifulSoup(recognizer.text,"html.parser")
                    temp=data.find("div",class_="BNeawe").text
                    speechtx(f"current{search}is{temp}")
                elif "time" in data1:
                    time=datetime.datetime.now().strftime("%I%M%p")
                    speechtx(time)
                elif "date" in data1:
                    current_date=datetime.date.today()
                    speechtx(current_date)
                elif "joke" in data1:
                    joke=pyjokes.get_joke(language='en',category='neutral')
                    print(joke)
                    speechtx(joke)
                elif "youtube" in data1:
                    speechtx("This is what i found for you search!")
                    d=data1.replace("youtube search","")
                    d=data1.replace("youtube","")
                    d=data1.replace("alpha","")
                    web="https://www.youtube.com/results?search_query=" + d
                    webbrowser.open(web)
                    pywhatkit.playonyt(data1)
                    speechtx("Done, Sir")
                elif "chatgpt" in data1:
                    speechtx("yeah opening")
                    webbrowser.open("https://chat.openai.com/")
                elif "play song" in data1:
                    add="C:\music"
                    listsong=os.listdir(add)
                    print(listsong)
                    os.startfile(os.path.join(add,listsong[1]))    
                elif "wikipedia" in data1:
                    speechtx("searching from wikipedia...")
                    l=data1.replace("wikipedia","")
                    l=data1.replace("search wikipedia","")
                    l=data1.replace("alpha","")
                    results=wikipedia.summary(data1,sentences=3)
                    speechtx("According to Wikipedia")
                    print(results)
                    speechtx(results)   
                elif "google" in data1:
                    import wikipedia as googleScrap
                    t=data1.replace("alpha","")
                    t=data1.replace("google search","")
                    t=data1.replace("google","")
                    speechtx("This is what i found on google")  
                    
                    try:
                        pywhatkit.search(data)
                        result=googleScrap.summary(data1,1)
                        speechtx(result)
                    except:
                        speechtx("No speakable output available")
                elif "exit" in data1:
                    speechtx("Thank you")
                    break
    else:
        print('Wrong Password')
        speechtx('Wrong Password')

Output:

Conclusion – Elevate Your Digital Experience with “alpha”


In a world where technology meets convenience, “alpha” emerges as your personal voice-controlled assistant. It listens, responds, and empowers your digital life with ease.Alpha0698 delivers quick weather updates, humor, music, and information at your command. Beyond that, it’s a project of endless potential, ready for your customization.


In this era of seamless human-computer interaction, alpha0698 is your bridge to knowledge, entertainment, and assistance through your voice. Welcome to a future where “alpha0698” amplifies your digital journey.


Explore, engage, and embrace the possibilities with “alpha.”

Share your love
Tanmaya Sahu
Tanmaya Sahu

Tanmaya Sahu's Journey from Chemistry to IT and Data Science

Hello, I'm Tanmaya Sahu, a determined individual hailing from Bhubaneswar, India. My journey has been one of transformation, from a fresh graduate with a degree in Chemistry Honors to a budding professional with a passion for Information Technology and Data Science.

Educational Pursuits:

My academic journey began at Brajrajnagar College, where I pursued my Bachelor's degree in Chemistry Honors from 2018 to 2021. During those years, I found myself immersed in the world of chemistry, yet uncertain about my future path. Like many students, I was relishing the college experience but lacked a clear vision of my career aspirations.

It was only during my final year of graduation that I realized the importance of securing a stable job. I embarked on a quest for local employment opportunities, but my initial search was plagued by confusion and uncertainty. However, these challenges pushed me to reassess my ambitions and contemplate further studies.

Choosing a Path:

The decision-making process was not straightforward. I contemplated pursuing an MSc in Chemistry or venturing into the world of business and technology with an MBA or MCA. The plethora of options and my evolving interests made the choice a difficult one. Ultimately, I decided to pursue an MBA because it offered a versatile platform with diverse specializations, including Human Resources and Information Technology.

Although I was passionate about the IT sector, some external factors initially steered me toward HR and Finance. However, my heart continued to beat for Information Technology. After careful consideration, I decided to merge my interests and specialize in both HR and IT during my MBA journey.

Diving into the IT World:

During my MBA, I realized that merely scratching the surface of IT was not enough for me. I craved a deeper understanding and practical experience. This led me to explore various additional courses, and I delved into the world of Python programming.

Python was a challenge for me as a non-IT background student, but my determination pushed me forward. I discovered the fascinating world of data science, SQL, Power BI, Tableau, and statistics. With relentless dedication, I honed my skills and embarked on numerous projects, including creating voice assistants, developing GUI-based games, web scraping, and data analysis.

The Skill Set:

Today, I am proud to list Python, SQL, Data Science, Power BI, Tableau, and Statistics among my core competencies. I have undertaken a multitude of projects, demonstrating my proficiency in each of these domains. These projects have not only enriched my knowledge but have also provided practical, hands-on experience in the IT and data science fields.

In the realm of data analysis, I have uncovered valuable insights and trends, providing organizations with actionable information for strategic decision-making. My journey into IT has transformed me into a multifaceted professional, ready to contribute to the ever-evolving landscape of technology and data.

Get in Touch:

If you'd like to connect with me, discuss potential collaborations, or explore how my skills can benefit your organization, please feel free to reach out to me at 8594811431 or via email at [email protected]. I'm always eager to engage with like-minded individuals and tackle exciting projects that push the boundaries of innovation.

In my ever-evolving journey, I am excited to see what the future holds and how I can leverage my unique blend of expertise to make a positive impact in the world of Information Technology and Data Science. Thank you for joining me on this incredible adventure.

Articles: 72

Leave a Reply

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