Skip to main content

Azure Azure STT

The AzureSTTService leverages Microsoft Azure's Cognitive Services Speech SDK for high-quality, real-time audio transcription. It is suitable for applications requiring broad language support and deep integration with the Azure ecosystem.

Installation

To use Azure STT, install the required dependencies:

pip install "piopiy-ai[azure]"

Prerequisites

  • An Azure subscription and a Speech service resource (Get yours here).
  • Azure API key and region (e.g., eastus).
  • Set your credentials in your environment:
    export AZURE_SPEECH_API_KEY="your_api_key_here"
    export AZURE_SPEECH_REGION="your_region_here"

Configuration

AzureSTTService Parameters

ParameterTypeDefaultDescription
api_keystrRequiredAzure Speech subscription key.
regionstrRequiredAzure region (e.g., "eastus").
languageLanguageEN_USLanguage for speech recognition.
sample_rateintNoneAudio sample rate in Hz.
endpoint_idstrNoneCustom model endpoint ID (if using Custom Speech).

Usage

Basic Setup

import os
from piopiy.services.azure.stt import AzureSTTService
from piopiy.transcriptions.language import Language

stt = AzureSTTService(
api_key=os.getenv("AZURE_SPEECH_API_KEY"),
region=os.getenv("AZURE_SPEECH_REGION"),
language=Language.EN_US
)

Notes

  • Continuous Recognition: The service uses Azure's continuous recognition mode, providing both interim and final results as the user speaks.
  • Custom Models: If you have trained a custom speech model in Azure Speech Studio, you can provide the endpoint_id to use it.