From 64e44fb24f5eafedefb8df536877dc4da51f1352 Mon Sep 17 00:00:00 2001 From: choomegan Date: Tue, 15 Jul 2025 15:27:44 +0800 Subject: [PATCH] fix: logic of adding of pcm_array to diarization_queue --- whisperlivekit/audio_processor.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/whisperlivekit/audio_processor.py b/whisperlivekit/audio_processor.py index bc65da6..cfee99e 100644 --- a/whisperlivekit/audio_processor.py +++ b/whisperlivekit/audio_processor.py @@ -192,12 +192,6 @@ class AudioProcessor: continue self.pcm_buffer.extend(chunk) - - # Send to diarization if enabled - if self.args.diarization and self.diarization_queue: - await self.diarization_queue.put( - self.convert_pcm_to_float(self.pcm_buffer).copy() - ) # Process when enough data if len(self.pcm_buffer) >= self.bytes_per_sec: @@ -214,7 +208,11 @@ class AudioProcessor: # Send to transcription if enabled if self.args.transcription and self.transcription_queue: await self.transcription_queue.put(pcm_array.copy()) - + + # Send to diarization if enabled + if self.args.diarization and self.diarization_queue: + await self.diarization_queue.put(pcm_array.copy()) + # Sleep if no processing is happening if not self.args.transcription and not self.args.diarization: await asyncio.sleep(0.1)