Gist e6556a05221bd9819d98cc5a5363a364
✓ Published0🌍 Public
CCheckroth
Last edited Apr 30, 2020
Created on Apr 30, 2020
This example shows a live speech-to-text service that streams raw PCM audio from an HTTP request body into Microsoft Azure's Speech SDK for real-time transcription. The Python code implements a custom `PullAudioInputStream` callback that incrementally reads bytes from the Gunicorn request stream and writes them into a `BytesIO` buffer, while the falcon endpoint's `on_post` method triggers recognition. As Azure processes the audio, callback functions capture recognized and intermediate results, which are accumulated into lists along with timing and confidence data. The implementation uses the `speechsdk.audio` module, datetime for soft timeouts, and JSON parsing to extract transcription details from recognition events.
AI-generated description