jafrizzell / moonlights-transcribe

0 stars 0 forks source link

Roll 1 second of audio stream into next transcription #7

Open jafrizzell opened 1 year ago

jafrizzell commented 1 year ago

To help prevent words from getting cut off on the boundaries of the 10-second audio chunks, append the final 1 second of audio data to the next audio segment.

This should allow Whisper to better pick up words that get cut off.

To prevent duplicate words from appearing at the end of one transcription and the start of the next, check the prev_transcript value:

Using the formatted output from #2:

if streams[s]['prev_transcript'].split(" ")[-1] == formatted_text.split(" ")[0]:
  formatted_text = " ".join(formatted_text.split(" ")[1:])

Performance impact: Little to none