Python Forum
Continous Speech Recognition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Continous Speech Recognition
#1
Hi all,

I am new to this forum and also a bit new to Python to be honest.

I decided to create a project with Python where a microphone listens to a conversation and while listening it gets translated to an other language. Similar to Google Translate on Mobile.

I managed to get input from microphone using PyAudio and also write whats being said and translated to any language i want using google translate pips. At the moment i am only able to do sentence by sentence.

My problem is how should i tackle a live conversation rather than have to stop to process audio to text. Sort of one person is speaking and while the microphone is capturing data, it is being procesed.

This is my code so far:

import speech_recognition as sr
import io
from googletrans import Translator

# print(sr.Microphone.list_microphone_names())
r = sr.Recognizer()


while True:
    result = 0
    f = open("subtitles.txt", "a")
    with sr.Microphone() as source:
        print("Speak Now:")
        audio = r.listen(source)

    try:
        text = r.recognize_google(audio, language="en")
        print("You said: {}".format(text))
    except:
        print('Sorry could not recognize your voice')
        f.write("problem" + '\n')


    translator = Translator()
    result = translator.translate(text, src='en', dest='es')
    f.write(result.text + '\n')
    f.close()
Thanks a lot for your hlep
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Speech Recognition with timestamps DeanAseraf1 3 6,577 Jun-27-2021, 06:58 PM
Last Post: gh_ad
  text to speech Heyjoe 11 6,796 Jul-02-2020, 01:32 AM
Last Post: Heyjoe
  Googles Text to speech justindiaz7474 0 1,658 May-06-2020, 02:04 AM
Last Post: justindiaz7474
  Python Speech recognition, word by word AceScottie 6 15,989 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  Simulation of Text to speech (without using mic) to Voice recognition suported hardwa Helloworld20 2 2,220 Apr-08-2020, 02:13 AM
Last Post: Helloworld20
  Python Speech Engines? Robo_Pi 2 2,091 Mar-12-2020, 02:46 PM
Last Post: Robo_Pi
  Speech Recognition Ash23733 1 8,608 Dec-12-2018, 10:00 PM
Last Post: nilamo
  Need Help With Text to Speech App Lethe 0 1,977 Oct-24-2018, 10:03 PM
Last Post: Lethe
  [split] Offline audio to text (Speech Recognition) Nishant260190 0 3,924 Sep-02-2018, 12:33 PM
Last Post: Nishant260190
  Using Windows Speech to Text jmair 2 3,144 May-08-2018, 01:40 PM
Last Post: jmair

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020