r/iosdev • u/giusscos • 4h ago
What I learned making a teleprompter scroll along with your voice, word by word, using Apple's Speech framework
I've been building a teleprompter app on my own, and the hardest feature was making the script follow you as you speak instead of scrolling at a fixed speed. A few things that weren't obvious:
1. Recognition tasks stop on their own. An SFSpeechRecognitionTask doesn't run forever: it finishes, and a long take carries on past it. I start a fresh request the moment the old one ends and keep a rolling buffer of the latest recognized words. The user never notices the switch.
2. Prefer on-device, but don't require it. requiresOnDeviceRecognition is great for privacy and speed, but not every language and device supports it. I ask for on-device recognition when it's available and fall back otherwise.
3. Names are what recognition gets wrong. I pull the unusual words out of the script (names, brands, jargon) and pass them as contextualStrings. That made a big difference for real scripts.
4. Don't trust one word. A single misheard word can't be allowed to make the script jump. I normalize words and only move forward when a run of recent words matches the script.
5. Always have a fallback. If recognition fails several times in a row, or the language isn't supported, the app quietly switches to following how loud you are, so the script still moves while you talk.
6. Pick the language from the script, not the phone. A user with an Italian iPhone reading an English script needs an English recognizer. I detect the script's language and use the user's region where it fits.
Happy to go deeper on any of these, especially how the matching works. What have others hit with the Speech framework?
(The app is yPrompt on iOS and Mac, link here)


