AndreasArvidsson / andreas-talon

User scripts for Talon Voice
MIT License
73 stars 11 forks source link

Looking for Advice: How to enable Pop to 'talon wake'? #9

Closed wisehackermonkey closed 1 year ago

wisehackermonkey commented 1 year ago

Super awesome talon config!

i'm wondering how do i just get the poping to turn on talon.

"Wake Talon on double pop noise " to work for "talon wake" "on_pop.py" and "sleep.py"

Wake Talon on double pop noise - When Talon is in sleep mode a rapid double pop noise will wake Talon on_pop.py sleep.py

any advice would be wonderful! thanks

AndreasArvidsson commented 1 year ago

Glad you like it!

If you just want a double pop to wake up from sleep you could try the following

from talon import noise, actions
import time

time_last_pop = 0

def talon_wake_on_pop():
    """Use pop sound to wake from sleep"""
    global time_last_pop
    delta = time.time() - time_last_pop
    if delta >= 0.1 and delta <= 0.3:
        actions.speech.enable()
    time_last_pop = time.time()

def on_pop(active: bool):
    if not actions.speech.enabled():
        talon_wake_on_pop()

noise.register("pop", on_pop)