Skip to content

Let scripts add voice commands - #405

Open
amanKG777 wants to merge 1 commit into
trypsynth:masterfrom
amanKG777:voice-script-commands
Open

amanKG777 wants to merge 1 commit into
trypsynth:masterfrom
amanKG777:voice-script-commands

Conversation

@amanKG777

@amanKG777 amanKG777 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

This lets scripts add voice commands, so a script can react to something you say after the voice command gesture.

A script can add voice: 'phrase', or a list of phrases, to any command in its manifest. When you say one of them, Backtalk runs that command with via: 'voice', and the event has command and remainder. A script can also call backtalk.onVoiceCommand(pattern, callback) to register an exact phrase, a fuzzy phrase, or a pattern with a wildcard such as 'search for *', which hands the callback the words that matched. Script commands are checked before the built-in voice commands, and only for a final speech result, so a half-heard phrase can't run a script. A script's list of triggers now shows its voice phrases as "Voice: …". The API is described in docs/scripting.md, and in differences.md.

Nothing changes for scripts that don't use voice, and the commands only run when you say them after the voice command gesture, so there is no switch.

Tested on a POCO M7 5G with Android 16, using Google's speech recognition service with voice commands spoken after the voice command gesture. ManifestParserTest covers reading voice from a manifest, and testPhoneDebugUnitTest passes cleanly.

@amanKG777
amanKG777 force-pushed the voice-script-commands branch from c53e8bb to b3f0b40 Compare November 1, 2026 22:47
@amanKG777
amanKG777 marked this pull request as ready for review November 2, 2026 00:10
@trypsynth

Copy link
Copy Markdown
Owner

Thanks, this is the direction I want, with more done in scripts and less in the core. One request: please move scripting/fukex_voice_controls.js to backtalk-scripts. Example and user scripts go there, so this PR is just the API change and its docs. I'll review the rest after that.

A script can add voice: 'phrase' to a command in its manifest, or call
backtalk.onVoiceCommand(pattern, callback) to register a phrase or a
pattern such as 'search for *'. When the phrase is spoken after the voice
command gesture, the script's command runs.
@amanKG777
amanKG777 force-pushed the voice-script-commands branch from b3f0b40 to 3051a17 Compare November 15, 2026 03:45
@amanKG777

Copy link
Copy Markdown
Contributor Author

Removed \scripting/fukex_voice_controls.js\ from this PR and rebased onto the latest master to resolve all conflicts. This PR is now focused purely on the voice commands API changes and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants