Real-time streaming speech-to-text via the MEAI ISpeechToTextClient interface.
Uses the generated realtime client internally for model and language selection.
This example assumes using Deepgram; is in scope and apiKey contains your Deepgram API key.
usingvarclient=newDeepgramClient(apiKey);ISpeechToTextClientspeechClient=client;// Download a short audio sample to use as streaming input.usingvarhttpClient=newHttpClient();varaudioBytes=awaithttpClient.GetByteArrayAsync("https://dpgr.am/spacewalk.wav");usingvaraudioStream=newMemoryStream(audioBytes);// Stream audio through the MEAI ISpeechToTextClient interface.// This uses the generated realtime client internally with model and language params.varupdates=newList<SpeechToTextResponseUpdate>();awaitforeach(varupdateinspeechClient.GetStreamingTextAsync(audioStream,newSpeechToTextOptions{ModelId=DeepgramClient.Nova3ModelId,SpeechLanguage="en",})){updates.Add(update);if(update.Kind==SpeechToTextResponseUpdateKind.TextUpdated){Console.WriteLine($"Final: {update.Text}");}}// Verify we received session events and transcription results.varfinalTranscripts=updates.Where(u=>u.Kind==SpeechToTextResponseUpdateKind.TextUpdated&&u.Textis{Length:>0}).Select(u=>u.Text!).ToList();Console.WriteLine($"Total final transcripts: {finalTranscripts.Count}");