Installation

Get started with our library by following these simple steps.

Python

pip install wavify

Quick Start

Get up and running with our library in no time.

Download models from GitHub.

Speech-to-text

import os
from wavify.stt import SttEngine

engine = SttEngine("path/to/your/model", os.getenv("WAVIFY_API_KEY"))
result = engine.stt_from_file("/path/to/your/file")
print(result)

Wake-word detection

import os
from wavify.wakeword import WakeWordEngine

engine = WakeWordEngine("path/to/your/model", os.getenv("WAVIFY_API_KEY"))
audio = ... # audio needs to be 2 seconds sampled at 16kHz, 16 bit linearly encoded and single channel
detection_probability = engine.detect(audio)

API Reference

Explore the available methods and options in the library.

Python

stt.SttEngine = class SttEngine(builtins.object)
 |  stt.SttEngine(model_path: str, api_key: str, lib_path=None)
 |  
 |  A class to represent the Speech-to-Text (STT) engine.
 |  
 |  Attributes:
 |      lib (CDLL): The loaded wavify core library.
 |      engine_inner (POINTER(SttEngineInner)): A pointer to the inner STT engine structure.
 |  
 |  Methods defined here:
 |  
 |  __init__(self, model_path: str, api_key: str, lib_path=None)
 |      Initialize the STT engine.
 |      
 |      Args:
 |          model_path (str): The path to the model file.
 |          api_key (str): The API key for authentication.
 |          lib_path (Path, optional): The path to the library. If None, default paths will be used.
 |      
 |      Raises:
 |          NotImplementedError: If the provided library path is not supported.
 |  
 |  destroy(self)
 |      Destroy the STT engine and free resources.
 |  
 |  stt(self, data)
 |      Perform speech-to-text on the given data.
 |      
 |      Args:
 |          data (list): A list of float values representing the audio data.
 |      
 |      Returns:
 |          str: The transcribed text.
 |  
 |  stt_from_file(self, file: pathlib.Path)
 |      Perform speech-to-text on audio data from a mono, 16bit wave file.
 |      
 |      Args:
 |          file (Path): The path to the wave file.
 |      
 |      Returns:
 |          str: The transcribed text.
 
 
wakeword.WakeWordEngine = class WakeWordEngine(builtins.object)
 |  wakeword.WakeWordEngine(model_path: str, api_key: str, lib_path=None)
 |  
 |  A class to represent the wakeword engine.
 |  
 |  Attributes:
 |      lib (CDLL): The loaded wavify core library.
 |      engine_inner (POINTER(WakeWordEngineInner)): A pointer to
 |          the inner wakeword engine structure.
 |  
 |  Methods defined here:
 |  
 |  __init__(self, model_path: str, api_key: str, lib_path=None)
 |      Initialize the wakeword engine.
 |      
 |      Args:
 |          model_path (str): The path to the model file.
 |          api_key (str): The API key for authentication.
 |              lib_path (Path, optional): The path to the library.
 |              If None, default paths will be used.
 |      
 |      Raises:
 |          NotImplementedError: If the provided library path is not supported.
 |  
 |  destroy(self)
 |      Destroy the wakeword engine and free resources.
 |  
 |  detect(self, data)
 |      Perform wakeword detection on the given data.
 |      
 |      Args:
 |          data (list): A list of float values representing the audio data.
 |              The length should be equal to 2 seconds sampled at 16kHz.
 |      
 |      Returns:
 |          float: The probability that the audio contains the wakeword.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)