Skip to content

Commit

Permalink
Add wake word name to HTTP server
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Oct 15, 2024
1 parent 2937bd2 commit 12c237d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wyoming/http/wake_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from wyoming.audio import wav_to_chunks
from wyoming.client import AsyncClient
from wyoming.error import Error
from wyoming.wake import Detection, NotDetected
from wyoming.wake import Detect, Detection, NotDetected

from .shared import get_app, get_argument_parser

Expand All @@ -19,6 +19,7 @@

def main():
parser = get_argument_parser()
parser.add_argument("--wake-word-name", action="append")
parser.add_argument("--samples-per-chunk", type=int, default=1024)
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)
Expand All @@ -32,6 +33,9 @@ async def api_wake() -> Response:
raise ValueError("URI is required")

async with AsyncClient.from_uri(uri) as client:
if args.wake_word_name:
await client.write_event(Detect(args.wake_word_name).event())

with io.BytesIO(request.data) as wav_io:
with wave.open(wav_io, "rb") as wav_file:
chunks = wav_to_chunks(
Expand Down

0 comments on commit 12c237d

Please sign in to comment.