"""
for item in timestamps:
word = item["text"]
start = float(item["start_time"])
end = float(item["end_time"])
if end <= start:
continue
s_idx = max(0, int(start * sr))
e_idx = min(len(audio), int(end * sr))
if e_idx <= s_idx:
continue
seg = (np.clip(audio[s_idx:e_idx], -1.0, 1.0) * 32767).astype(np.int16)
buf = io.BytesIO()
wav_write(buf, sr, seg)
b64 = base64.b64encode(buf.getvalue()).decode()
html += f"""
{word}
{start:.2f}s - {end:.2f}s
"""
html += "