|
@@ -56,6 +56,7 @@ class TranscriptSink:
|
|
|
rms: float = 0.0,
|
|
rms: float = 0.0,
|
|
|
reason: str = "unknown",
|
|
reason: str = "unknown",
|
|
|
audio: np.ndarray | None = None,
|
|
audio: np.ndarray | None = None,
|
|
|
|
|
+ transcribe_s: float | None = None,
|
|
|
) -> str | None:
|
|
) -> str | None:
|
|
|
"""Emit a transcript result.
|
|
"""Emit a transcript result.
|
|
|
|
|
|
|
@@ -65,6 +66,8 @@ class TranscriptSink:
|
|
|
rms: Root-mean-square level of the utterance audio.
|
|
rms: Root-mean-square level of the utterance audio.
|
|
|
reason: Why the utterance ended (end_of_turn/pause/hard_cap/flush).
|
|
reason: Why the utterance ended (end_of_turn/pause/hard_cap/flush).
|
|
|
audio: Utterance samples (float32, mono); saved when save_audio is enabled.
|
|
audio: Utterance samples (float32, mono); saved when save_audio is enabled.
|
|
|
|
|
+ transcribe_s: Wall-clock seconds spent transcribing this utterance.
|
|
|
|
|
+ None omits the field from the record.
|
|
|
|
|
|
|
|
Returns:
|
|
Returns:
|
|
|
Path of the saved audio file, or None if nothing was saved/emitted.
|
|
Path of the saved audio file, or None if nothing was saved/emitted.
|
|
@@ -107,6 +110,8 @@ class TranscriptSink:
|
|
|
}
|
|
}
|
|
|
if audio_path is not None:
|
|
if audio_path is not None:
|
|
|
record["audio"] = str(audio_path)
|
|
record["audio"] = str(audio_path)
|
|
|
|
|
+ if transcribe_s is not None:
|
|
|
|
|
+ record["transcribe_s"] = round(transcribe_s, 3)
|
|
|
|
|
|
|
|
with open(jsonl_path, "a", encoding="utf-8") as f:
|
|
with open(jsonl_path, "a", encoding="utf-8") as f:
|
|
|
json.dump(record, f, ensure_ascii=False)
|
|
json.dump(record, f, ensure_ascii=False)
|