Temp
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -41,6 +41,9 @@ class AudioListener:
|
||||
target_samples = int(self.sample_rate * self.chunk_duration)
|
||||
chunk = chunk[:target_samples]
|
||||
|
||||
# Flatten to 1D array (samples,) as expected by faster-whisper
|
||||
chunk = chunk.flatten()
|
||||
|
||||
# Use call_soon_threadsafe to put the chunk into the asyncio queue from the callback thread
|
||||
self.loop.call_soon_threadsafe(self.audio_queue.put_nowait, chunk)
|
||||
self._buffer = []
|
||||
|
||||
@@ -46,8 +46,8 @@ class Transcriber:
|
||||
return ""
|
||||
|
||||
try:
|
||||
# faster-whisper expects audio in float32
|
||||
audio_data = audio_chunk.astype("float32")
|
||||
# faster-whisper expects audio in float32 and 1D array
|
||||
audio_data = audio_chunk.astype("float32").flatten()
|
||||
|
||||
# Transcribe the audio
|
||||
segments, info = self.model.transcribe(audio_data, beam_size=5)
|
||||
|
||||
Reference in New Issue
Block a user