pythongithubpycharmpyaudioportaudio

How do I install PortAudio on Windows?


What I want to do:

I want to convert my voice input into text output in my python program (using PyCharm IDE), I have successfully installed PyAudio but my program didn't function, then I realize I need PortAudio on my PC, but I don't have a clue how to install it,

What I tried:

I downloaded the pa_stable_v190700_20210406.tgz file, from the official portaudio website which also got a link to its GitHub, I am new to GitHub and I am very confused, can you guide me step by step on how to install PortAudio to my PC?


Solution

  • if all you are trying to do Is speech to text this simple code should work, first run pip install SpeechRecognition then this code should work

    import speech_recognition as sr
    
    r = sr.Recognizer()
    
    with sr.Microphone() as source:
        print("Listening...")
        audio = r.listen(source)
    
    try:
        print("Recognizing...")
        text = r.recognize_google(audio)
        print("You said:", text)
    except sr.UnknownValueError:
        print("Sorry, I could not understand your speech.")
    except sr.RequestError as e:
        print("Sorry, an error occurred. {0}".format(e))