arkadaşlar merhabalar.
speech_recognition kütüphanesi ile mikrofonu kullanıp hem sesli hem de yazılı bir şekilde dosyaları kayıt edebiliyorum.
Sıkıntı şu: kullanıcı ara yüzü oluşturmak istiyorum.
start butonuna bastığında başlasın
stop dediğim de dinlemeyi bıraksın
save dediğimde sesli ve metin olarak kaydetsin istiyorum.
şimdi hepsinin kodlarını yaptım fakat bir yerde tıkandım. Kod aşağıda
import speech_recognition as sr
import tkinter as tk
def start(read):
with sr.Microphone() as source:
read.adjust_for_ambient_noise(source)
print("Şimdi konuşabilirsiniz...\n🔉")
audio = read.listen(source, timeout=stop())
text = read.recognize_google(audio_data=audio,language="tr-TR")
speech_text_recording(text)
try:
print("👂:\t" + read.recognize_google(audio_data=audio,language="tr-TR"))
except Exception as e:
print("Error:\t" + str(e))
return audio
def stop():
pass
def speech_record(audio):
with open("speech.wav", "wb") as f:
f.write(audio.get_wav_data())
print("ses olarak kaydedildi")
def speech_text_recording(text):
with open("text.txt", "w") as f1:
f1.write(text)
print("metin olarak kaydedildi")
def main():
read = sr.Recognizer()
window = tk.Tk()
window.geometry("480x128")
start_button = tk.Button(window,text="Start", command=start(read))
start_button.pack()
stop_button = tk.Button(window,text="Stop", command=stop)
stop_button.pack()
speech_save_button = tk.Button(window,text="speech save", command=speech_record)
speech_save_button.pack()
text_save_button = tk.Button(window,text="text save", command=speech_text_recording)
text_save_button.pack()
exit = tk.Button(window,text="Quit", command=window.quit)
exit.pack()
if start_button.se == True:
print("yessss")
window.mainloop()
if __name__ == '__main__':
main()
buton içinde fonksiyonların argümanlarını verirsem kendisi otomatik çağırıyor ve hata oluşuyor. argümansız nasıl olacak bilmiyorum.