MCPcopy
hub / github.com/Fosowl/agenticSeek / _select_voice_interactively

Method _select_voice_interactively

sources/interaction.py:83–104  ·  view source on GitHub ↗

Let the user audition voices and choose one by index. Args: language: Spoken language code passed to Speech. Returns: int: The chosen voice index.

(self, language)

Source from the content-addressed store, hash-verified

81
82
83 def _select_voice_interactively(self, language):
84 """Let the user audition voices and choose one by index.
85 Args:
86 language: Spoken language code passed to Speech.
87 Returns:
88 int: The chosen voice index.
89 """
90 voice_count = Speech().available_voice_count(language)
91 if voice_count <= 1:
92 return 0
93
94 SAMPLE_LINE = "Hello, this is how I sound. Should I use this voice?"
95 idx = 0
96 preview = Speech(enable=True, language=language, voice_idx=idx)
97 while True:
98 pretty_print(f"Voice {idx + 1}/{voice_count}", color="status")
99 preview.set_voice(idx)
100 preview.speak(SAMPLE_LINE)
101 choice = self._prompt_voice_choice(idx, voice_count)
102 if choice == "accept":
103 return idx
104 idx = self._next_voice_index(choice, idx, voice_count)
105
106
107 def _prompt_voice_choice(self, current_idx, voice_count):

Callers 1

initialize_ttsMethod · 0.95

Calls 7

set_voiceMethod · 0.95
speakMethod · 0.95
_prompt_voice_choiceMethod · 0.95
_next_voice_indexMethod · 0.95
SpeechClass · 0.90
pretty_printFunction · 0.90
available_voice_countMethod · 0.80

Tested by

no test coverage detected