Failed in 'src/hostapi/alsa/pa_linux_alsa.c'

I am trying to run the code in python and I want to give the input from the microphone but it gives me this error.

My Python Code:

                        import os
                        import time
                        import playsound
                        import speech_recognition as s
                        from gtts import gTTS

                        def speak(text):
                                   tts = gTTS(text=text, lang="en-us",slow=False)
                                   filename = "voice.mp3"
                                   tts.save(filename)
                                   playsound.playsound(filename)

                        def get_audio():
                                    r = sr.Recognizer()
                                    with sr.Microphone() as source:
                                           print("Listening...")
                                           r.pause_threshold = 1
                                           audio = r.listen(source)
                                           try:
                                                 print("Recoginizing...")
                                                 said = r.recognize_google(audio)
                                                 print(said)
                                            except Exception as e:
                                                 print("Exception:",str(e))
                                     return said




                        #calling the function
                        get_audio()

Error:

         /home/kayshika/project_alice/bin/python /home/kayshika/project_alice/pratics.py
         Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwPa&alsaPeriodFrames, &dir )' failed in 'src/hostapi /alsa/pa_linux_alsa.c', line: 933

please tell me what I do