Skip to content

README outdated #330

@NovaH00

Description

@NovaH00

So the example in README is outdated, you can use the following snippet for simple usage

import sounddevice as sd
import numpy as np
from openwakeword.model import Model
from openwakeword import models

oww_model = Model([models["hey_jarvis"]["model_path"]]) 

def callback(indata, frames, time, status):
    audio_frame = (indata.flatten() * 32767).astype(np.int16)
    prediction = oww_model.predict(audio_frame)
    for mdl, score in prediction.items():
        if score > 0.5:
            print(f"Detected {mdl}!")

with sd.InputStream(samplerate=16000, channels=1, blocksize=1280, callback=callback):
    while True:
        sd.sleep(1000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions