AzureSpeechSTT<T>

Models & Types · AiDotNet.SpeechRecognition.ProprietaryAPI

Azure Speech’s nearest disclosed recognizer: Microsoft’s streaming Conformer transducer (Chen et al. 2021), a stand-in for the hosted service.

Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → AzureSpeechSTT<T>

Implements: ISpeechRecognizer<T>

For Beginners

This model turns 16 kHz audio into an 80-band log-mel spectrogram, shortens it 4x with two convolutions and encodes it with Conformer blocks that attend only within short chunks plus a bounded history, so it can run as audio arrives. A two-layer LSTM remembers the tokens written so far and a joint network combines it with each audio frame to pick the next token or “nothing yet”.

How It Works

This is a stand-in, not Microsoft’s production Azure model, whose architecture and weights are not published. It is the nearest architecture Microsoft has disclosed for streaming recognition at Azure scale: the Conformer transducer (C-T) of Chen et al. 2021, section 4.1, with chunk-wise attention over a truncated history (section 3.2). From the paper: a Conformer encoder of width 640 with a 3-wide depthwise kernel, a prediction network of two LSTM layers of 720 units, a joint network, 4,000 sentence pieces, and chunks of 24 frames of 30 ms (720 ms) attending 60 frames (1.8 s) of history. Inferred: 18 layers and 1,024 feed-forward units (the paper gives them for its Transformer transducer and sizes C-T to match it), 8 heads (not stated), and a 640-wide joint network. The paper stacks eight 10 ms frames into a 30 ms step; this uses 4x convolution subsampling, so a chunk is 18 frames of 40 ms (the same 720 ms), and the history is 3 chunks (2.16 s, the nearest whole number of chunks above 1.8 s). The paper’s blocks use relative positional encoding; these use rotary position encoding. The paper gives no optimizer, so the default is AdamW.

Example

var architecture = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.SpeechRecognition,
    inputSize: 16000, outputSize: 34);
var model = new AzureSpeechSTT<float>(architecture);
var text = model.Transcribe(waveform).Text;

Constructors

Constructor Summary
AzureSpeechSTT(NeuralNetworkArchitecture<T> architecture, AzureSpeechSTTOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
AzureSpeechSTT(NeuralNetworkArchitecture<T> architecture, string modelPath, AzureSpeechSTTOptions options)

Properties

Property Summary
IReadOnlyList<string> SupportedLanguages { get; }
bool SupportsStreaming { get; }
bool SupportsWordTimestamps { get; }

Methods

Method Summary
IReadOnlyDictionary<string, T> DetectLanguageProbabilities(Tensor<T> audio)
IStreamingTranscriptionSession<T> StartStreamingSession(string language)
ModelMetadata<T> GetModelMetadata()
Task<TranscriptionResult<T>> TranscribeAsync(Tensor<T> audio, string language, bool? includeTimestamps, CancellationToken cancellationToken)
Tensor<T> ForwardForTraining(Tensor<T> input)
TranscriptionResult<T> Transcribe(Tensor<T> audio, string language, bool? includeTimestamps) Transcribes audio: the encoder and the transducer with greedy decoding.
string DetectLanguage(Tensor<T> audio)