We're creating code that translates audio from YouTube in live. I want to send the audio I'm listening to on my computer through the microphone. What should I do?
import speech_recognition
import pyaudio
import speech_recognition as sr
from speech_recognition import *
import os
import googletrans
translator = googletrans.Translator()
r = Recognizer()
m = Microphone()
voice_data = 0
while 1 == True:
with m as source: #음성인식
audio = r.listen(source)
try:
Text = r.recognize_google(audio, language='en')
result = translator.translate(Text, dest='ko')
print(result.text)
except:
print("can't recognitize")