Skip to content

Commit 05219f9

Browse files
committed
chore: cleanup
1 parent 928a9ff commit 05219f9

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

src/rai/rai/agents/voice_agent.py

-32
Original file line numberDiff line numberDiff line change
@@ -197,35 +197,3 @@ def transcription_thread(self, identifier: str):
197197
)
198198
self.transcription_threads[identifier]["transcription"] = transcription
199199
self.transcription_threads[identifier]["event"].set()
200-
201-
# with self.transcription_lock:
202-
# while self.active_thread == identifier:
203-
# with self.sample_buffer_lock:
204-
# if len(self.sample_buffer) == 0:
205-
# continue
206-
# audio_data = self.sample_buffer.copy()
207-
# self.sample_buffer = []
208-
# audio_data = np.concatenate(audio_data)
209-
# with self.transcription_lock:
210-
# self.transcription_model.transcribe(audio_data)
211-
212-
# # transciption of the reminder of the buffer
213-
# with self.sample_buffer_lock:
214-
# if identifier in self.transcription_buffers:
215-
# audio_data = self.transcription_buffers[identifier]
216-
# audio_data = np.concatenate(audio_data)
217-
# with self.transcription_lock:
218-
# self.transcription_model.transcribe(audio_data)
219-
# del self.transcription_buffers[identifier]
220-
# # self.transcription_model.save_wav(f"{identifier}.wav")
221-
# with self.transcription_lock:
222-
# transcription = self.transcription_model.consume_transcription()
223-
# self.logger.info(f"Transcription: {transcription}")
224-
# self.connectors["ros2"].send_message(
225-
# ROS2ARIMessage(
226-
# {"data": transcription}, {"msg_type": "std_msgs/msg/String"}
227-
# ),
228-
# "/from_human",
229-
# )
230-
# self.transcription_threads[identifier]["transcription"] = transcription
231-
# self.transcription_threads[identifier]["event"].set()

src/rai_asr/rai_asr/models/local_whisper.py

-19
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,6 @@ def __init__(self, model_name: str, sample_rate: int, language: str = "en"):
3232
self.whisper = whisper.load_model(self.model_name)
3333

3434
self.logger = logging.getLogger(__name__)
35-
# TODO: remove sample storage before PR is merged, this is just to enable saving wav files for debugging
36-
# self.samples = None
37-
38-
# def save_wav(self, output_filename: str):
39-
# assert self.samples is not None, "No samples to save"
40-
# combined_samples = self.samples
41-
# if combined_samples.dtype.kind == "f":
42-
# combined_samples = np.clip(combined_samples, -1.0, 1.0)
43-
# combined_samples = (combined_samples * 32767).astype(np.int16)
44-
# elif combined_samples.dtype != np.int16:
45-
# combined_samples = combined_samples.astype(np.int16)
46-
47-
# with wave.open(output_filename, "wb") as wav_file:
48-
# n_channels = 1
49-
# sampwidth = 2
50-
# wav_file.setnchannels(n_channels)
51-
# wav_file.setsampwidth(sampwidth)
52-
# wav_file.setframerate(self.sample_rate)
53-
# wav_file.writeframes(combined_samples.tobytes())
5435

5536
def transcribe(self, data: NDArray[np.int16]) -> str:
5637
normalized_data = data.astype(np.float32) / 32768.0

0 commit comments

Comments
 (0)