Dynamically switch voice style or emotion
mainYou can change the avatar's voice style (speaker or emotion) dynamically based on keywords found in the LLM output using a style_mapper. This is useful for making an avatar sound "angry" when specific keywords or tags (e.g., [face:angry]) are detected in the text stream.
For VOICEVOX, the mapper can convert style names to integer speaker IDs.
# Style mapper example: Switch to angry voice if "angry" is in LLM output
style_mapper = {
"angry": "3", # VOICEVOX: Zundamon (angry)
"happy": "1", # VOICEVOX: Zundamon (happy)
}
# Implementation logic: extract style info in @process_llm_chunk and pass to TTS