🐛[bugfix] Model: mic/speakerの音声入力処理のThreadの処理を修正(energyはまだ)

This commit is contained in:
misyaguziya
2024-05-06 01:29:44 +09:00
parent 3ea40e1bd3
commit 5566ebe401
2 changed files with 25 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
import time
from io import BytesIO
from threading import Event
import wave
@@ -38,6 +39,9 @@ class AudioTranscriber:
self.transcription_engine = "Whisper"
def transcribeAudioQueue(self, audio_queue, language, country):
if audio_queue.empty():
time.sleep(0.1)
return False
audio, time_spoken = audio_queue.get()
self.updateLastSampleAndPhraseStatus(audio, time_spoken)
@@ -75,6 +79,7 @@ class AudioTranscriber:
if text != '':
self.updateTranscript(text)
return True
def updateLastSampleAndPhraseStatus(self, data, time_spoken):
source_info = self.audio_sources