$npx -y skills add calesthio/OpenMontage --skill azure-speech-to-textTranscribe audio to text using Azure AI Speech (Fast Transcription REST API). Use when converting audio/video to text, generating subtitles, or processing spoken content in OpenMontage. Optional cloud STT provider — preferred when AZURE_SPEECH_KEY is configured; the local faster-
| 1 | # Azure AI Speech — Speech-to-Text |
| 2 | |
| 3 | Transcribe audio to text with **Azure Fast Transcription** — synchronous, |
| 4 | word-level timestamps, speaker diarization, and multi-language identification. |
| 5 | In OpenMontage this is exposed through the `azure_stt` tool (`capability=analysis`, |
| 6 | `provider=azure`). It is an **optional cloud STT provider** — when |
| 7 | `AZURE_SPEECH_KEY` is configured, prefer it for cloud transcription. The local |
| 8 | `transcriber` tool (faster-whisper) remains the **default offline path** and the |
| 9 | fallback when Azure is unavailable. |
| 10 | |
| 11 | > Docs: [Fast Transcription](https://learn.microsoft.com/azure/ai-services/speech-service/fast-transcription-create) · [Speech service overview](https://learn.microsoft.com/azure/ai-services/speech-service/spx-overview) |
| 12 | |
| 13 | ## Why Fast Transcription (not Batch) |
| 14 | |
| 15 | Azure exposes three STT surfaces. OpenMontage uses **Fast Transcription** because |
| 16 | the pipeline transcribes **local audio files**: |
| 17 | |
| 18 | | Surface | Input | Latency | Needs | |
| 19 | |---------|-------|---------|-------| |
| 20 | | **Fast Transcription** (used here) | local file, multipart POST | synchronous, sub-real-time | key + region | |
| 21 | | Batch Transcription | audio at a URL (Blob + SAS) | async job + polling | Blob storage plumbing | |
| 22 | | Speech SDK (`spx`) | mic / stream / file | streaming | native `azure-cognitiveservices-speech` package | |
| 23 | |
| 24 | Fast Transcription needs no Blob storage, no SAS URLs, and no native SDK — just |
| 25 | `requests` and the two env vars. |
| 26 | |
| 27 | ## Setup |
| 28 | |
| 29 | Create a **Speech** resource in the [Azure portal](https://portal.azure.com); |
| 30 | copy the key and region from its **Keys and Endpoint** page. |
| 31 | |
| 32 | ```bash |
| 33 | export AZURE_SPEECH_KEY=your_speech_resource_key |
| 34 | export AZURE_SPEECH_REGION=eastus # your resource's region |
| 35 | # export AZURE_SPEECH_ENDPOINT=https://... # optional: overrides region |
| 36 | ``` |
| 37 | |
| 38 | `azure_stt` reports `AVAILABLE` once `AZURE_SPEECH_KEY` plus either |
| 39 | `AZURE_SPEECH_REGION` or `AZURE_SPEECH_ENDPOINT` are set. |
| 40 | |
| 41 | ## Using it in a pipeline |
| 42 | |
| 43 | Prefer `azure_stt` over `transcriber` unless the run must be offline. Its output |
| 44 | matches the `transcriber` schema exactly, so it is a drop-in for `subtitle_gen` |
| 45 | and any stage that consumes a transcript. |
| 46 | |
| 47 | ```python |
| 48 | from tools.tool_registry import registry |
| 49 | registry.discover() |
| 50 | stt = registry._tools["azure_stt"] |
| 51 | |
| 52 | result = stt.execute({ |
| 53 | "input_path": "projects/my-video/assets/audio/narration.mp3", |
| 54 | # "language": "en", # ISO 639-1 or BCP-47 ("en-US"); omit for auto-ID |
| 55 | # "diarize": True, # speaker labels, no HuggingFace token needed |
| 56 | # "max_speakers": 4, |
| 57 | "output_dir": "projects/my-video/artifacts", |
| 58 | }) |
| 59 | if result.success: |
| 60 | segs = result.data["segments"] # [{id,start,end,text,words:[...]}] |
| 61 | words = result.data["word_timestamps"] # flat [{word,start,end,probability}] |
| 62 | ``` |
| 63 | |
| 64 | If `azure_stt` is unavailable (no key) or errors, fall back to `transcriber` |
| 65 | (local whisper) — its `execute` signature and output are identical. |
| 66 | |
| 67 | ## Parameters that matter |
| 68 | |
| 69 | - **`language`** — pass an ISO code (`"en"`) or a full locale (`"en-US"`). Pin it |
| 70 | when you know the language; it is faster and more accurate than auto-ID. |
| 71 | - **`candidate_locales`** — when `language` is omitted, Azure runs language |
| 72 | identification across this shortlist. Narrow it to the languages you actually |
| 73 | expect; a huge list slows detection and invites misclassification. |
| 74 | - **`diarize` / `max_speakers`** — enable for multi-speaker audio (interviews, |
| 75 | podcasts). Set `max_speakers` to the real upper bound. |
| 76 | - **`profanity_filter`** — `None` | `Masked` (default) | `Removed` | `Tags`. |
| 77 | |
| 78 | ## Response shape (mapped to the transcriber schema) |
| 79 | |
| 80 | The raw Azure response (`phrases[]` with `offsetMilliseconds` / `words[]`) is |
| 81 | converted to seconds and the OpenMontage transcript schema: |
| 82 | |
| 83 | ```json |
| 84 | { |
| 85 | "segments": [ |
| 86 | {"id": 0, "start": 0.0, "end": 2.4, "text": "Hello world", |
| 87 | "speaker": 1, |
| 88 | "words": [{"word": "Hello", "start": 0.0, "end": 0.5, "probability": 0.98}]} |
| 89 | ], |
| 90 | "word_timestamps": [{"word": "Hello", "start": 0.0, "end": 0.5, "probability": 0.98}], |
| 91 | "language": "en-US", |
| 92 | "duration_seconds": 2.4, |
| 93 | "provider": "azure" |
| 94 | } |
| 95 | ``` |
| 96 | |
| 97 | Note: Fast Transcription has no *per-word* confidence, so each word carries the |
| 98 | **phrase** confidence in `probability`. |
| 99 | |
| 100 | ## Limits & tips |
| 101 | |
| 102 | - Single file up to ~2 hours / a few hundred MB per request. For longer or bulk |
| 103 | jobs, use Azure Batch Transcription instead. |
| 104 | - Send |