Skip to content

Commit

Permalink
UI: Use same chimes as in voice command
Browse files Browse the repository at this point in the history
  • Loading branch information
paulovcmedeiros committed Mar 8, 2024
1 parent 7df15c9 commit 138814d
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions pyrobbot/app/app_page_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def voice_output(self) -> bool:
"""Return the state of the voice output toggle."""
return st.session_state.get("toggle_voice_output", False)

def play_chime(self, chime_type: str = "correct-answer-tone", parent_element=None):
def play_chime(self, chime_type: str = "success", parent_element=None):
"""Sound a chime to send notificatons to the user."""
chime = load_chime(chime_type)
self.render_custom_audio_player(
Expand Down Expand Up @@ -334,7 +334,7 @@ def continuous_text_prompt(self):

logger.debug("Running on continuous audio prompt. Waiting user input...")
with self.status_msg_container:
self.play_chime()
self.play_chime(chime_type="warning")
with st.spinner(f"{self.chat_obj.assistant_name} is listening..."):
while True:
with self.parent.text_prompt_queue.mutex:
Expand Down Expand Up @@ -377,7 +377,7 @@ def _render_chatbot_page(self): # noqa: PLR0915
self.parent.reply_ongoing.set()

if continuous_stt_prompt:
self.play_chime("option-select")
self.play_chime("success")
self.status_msg_container.success("Got your message!")
time.sleep(0.5)
elif continuous_stt_prompt:
Expand Down
8 changes: 1 addition & 7 deletions pyrobbot/app/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ def get_avatar_images():
@st.cache_data
def load_chime(chime_type: str) -> AudioSegment:
"""Load a chime sound from the data directory."""
type2filename = {
"correct-answer-tone": "mixkit-correct-answer-tone-2870.wav",
"option-select": "mixkit-interface-option-select-2573.wav",
}

return AudioSegment.from_file(
GeneralDefinitions.APP_DIR / "data" / type2filename[chime_type],
format="wav",
GeneralDefinitions.APP_DIR / "data" / f"{chime_type}.wav", format="wav"
)
Binary file not shown.
Binary file not shown.
Binary file added pyrobbot/app/data/success.wav
Binary file not shown.
Binary file added pyrobbot/app/data/warning.wav
Binary file not shown.

0 comments on commit 138814d

Please sign in to comment.