VoicePersona connects a spoken message to character chat. Hold a key, say what you want to say, and let the script turn it into text with a selected persona’s vocabulary.
The output is a chat message. There is no synthesized voice or voice cloning in this project. Local speech recognition handles the audio, and a set of text rules handles the character’s phrasing.
Keeping the persona in plain text
The setup chooses persona files for a character’s sex, race, and class. These are combined with a shared corrections file. Each rule maps a phrase to one or more alternatives, so the vocabulary can be edited without changing the Python script.
The replacement function considers longer phrases first and randomly selects an alternative when several are available. It is a small, inspectable approach to changing the style of a message. It does not ask a language model to invent a new sentence.
From microphone to message
The script offers the base and small Whisper models through faster-whisper, using CPU inference with int8 computation. A custom vocabulary prompt helps provide context for game-specific terms.
F8 is the push-to-talk key. Releasing it stops recording and starts transcription. After the text has been transformed, the script uses keyboard and clipboard automation to open chat, paste the message, and send it.
There is a separate path for spoken emotes: “emote wave” becomes /wave. That keeps a command from passing through the ordinary phrase replacement rules.
The limits of a small prototype
This version has a fixed recording buffer and a simple keyboard polling loop. Its text replacement uses substring matching, so context and word boundaries can produce awkward results. Sending also depends on the right window having focus.
Those are useful boundaries to be honest about. The source describes a focused Windows prototype, not a general voice assistant. A future revision could add a preview before sending and more careful phrase matching.
What interests me here is how a few understandable pieces can connect: local transcription, editable vocabulary, and a short path into an existing interface.
For the in-game side of that tinkering, see my notes on making custom World of Warcraft addons.