Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Wake Word delay - stay open listening after wake word for x seconds #184

Open
SkyCandy567 opened this issue Jan 21, 2025 · 4 comments

Comments

@SkyCandy567
Copy link

Thanks for a great program/script!

Is there a way, or can a way be added to have a wake word delay? What I mean by this, is a way for the recorder to stay listening without the need for a wake word for X amount of seconds after it detects the wake word in the context of a conversation.

For example, the user uses a wake word to wake the recorder, has a conservation with the LLM for 2-3 minutes, and when the recorder detects silence for X amount of seconds (say 1-2 minutes), it goes back to listing for a wake word?

My use case is this. I have an AI in a public game lobby. Users come up and chat with it for 1-2 minutes, then move on. Right now, the way the wake work works, with each new sentence they say, they need to use a wake work. For example:

  1. Player: Hey SkyNet, who had the most kills on the last game?
  2. SkyNet: The user with the most kills was SkyCandy. She had 21 kills with the MP9
  3. Player: Hey SkyNet, who had the most damage
  4. SkyNet: The user with the most damage was Crypto4x. He had 3000 damage with the AK
  5. Player: Hey Skynet.....

A more intuitive conversation would not require the player to use a wake word for each follow up question. When the conversation is "over" the LLM/recorder goes back to listening for a wake word...

  1. Player: Hey SkyNet, who had the most kills on the last game?
  2. SkyNet: The user with the most kills was SkyCandy. She had 21 kills with the MP9
  3. Player: Who had the most damage
  4. SkyNet: The user with the most damage was Crypto4x. He had 3000 damage with the AK
  5. Player: What is the average speed of an unladen swallow quote?
  6. SkyNet: An African swallow or a European Swallow...
  7. player leaves, silence for 1 minute (recorder is open listening for sound)
  8. Recorder goes back to listening for wake word after 1 minute of silence
@SkyCandy567 SkyCandy567 changed the title Feature Request Feature Request - Wake Word delay - stay open listening after wake word for x seconds Jan 21, 2025
@johnmalek312
Copy link
Contributor

johnmalek312 commented Jan 22, 2025

The issue is in your implementation.

Cases:

  1. Assuming your voice assistant has no interruption feature (players cant interupt while SkyNet is responding), you dont need to listen while SkyNet is responding. You can wake up the listener with recorder.start() or recorder.wakeup() after the SkyNet stopped playing the audio.

  2. If your voice assistant listens for interruptions (doesnt sound like it) then you would either call recorder.wakeup() on an interval until SkyNet is no longer recording or in the interruption logic.

Edit:

If you are using KoljaB/RealtimeTTS you can use on_audio_stream_stop callback argument.

# Initialize audio player
        self.audio_player = TextToAudioStream(
            engine=self.audio_engine,
            on_audio_stream_stop=self.on_play_stop # on_play_stop is the function that starts the listener 
        )
    def on_play_stop(self):
          text = self.recorder.text().strip() # put this in a seperate thread preferably since you are also recording audio

@SkyCandy567
Copy link
Author

SkyCandy567 commented Jan 22, 2025

This is what I first tried, however, people constantly talk around the same vicinity as her. Since she is constantly listening, she will pick up conversations that are not directed at her. I played with various noise gates, however, in the video game, it gives everyone about 7 feet from her the same volume level which means she is constantly responding to conversations that have nothing to do with her.

This is when I transitioned to the wake word to keep her from responding to every little conversation. This way, she doesn't respond unless a player is specifically talking to her. This issue doesn't lay with her being interrupted, more so that each subsequent statement/question from a user requires a wake word again.

@KoljaB
Copy link
Owner

KoljaB commented Jan 23, 2025

Can you please try wake_word_activation_delay parameter?

@SkyCandy567
Copy link
Author

Thank you!! I think that is what I am looking for. For some reason, I thought that was just when it started up for the very first time 🤦‍♀️

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

No branches or pull requests

3 participants