r/coolgithubprojects • • 32m ago

Get word timestamps from a transcript you already have with speech-swift

https://github.com/soniqo/speech-swift/releases/tag/v0.0.30

I maintain speech-swift. If you already have the script for a recording, speech align gives you a start and end time for each word. In v0.0.30 we fixed timestamp handling for repeated words.

I made a short WAV with macOS’s Samantha voice and ran the release on it.

say -v Samantha -r 145 -o recording.wav --file-format=WAVE --data-format=LEI16@24000 "I, I can hear you."
speech align recording.wav --text "I, I can hear you." --language en

Here’s the output. The two I’s get their own spans.

[0.00s - 0.40s] I,
[0.56s - 0.80s] I
[0.80s - 0.96s] can
[0.96s - 1.28s] hear
[1.28s - 1.59s] you.

The first run downloads the alignment model. The audio is processed on your Mac. If you use word timings in an editor, which format is easiest to import?

Forced alignment guide

1 Upvotes

0 comments sorted by