Skip to content

Speech To Text Client Get Text Async

This example assumes using Deepgram; is in scope and apiKey contains your Deepgram API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using var client = new DeepgramClient(apiKey);
ISpeechToTextClient speechClient = client;

// Transcribe audio using the MEAI ISpeechToTextClient interface.
// Deepgram requires an audio URL via RawRepresentationFactory.
using var dummyStream = new MemoryStream();
var response = await speechClient.GetTextAsync(dummyStream, new SpeechToTextOptions
{
    ModelId = "nova-3",
    RawRepresentationFactory = _ => new ListenV1RequestUrl
    {
        Url = "https://dpgr.am/spacewalk.wav",
    },
});

Console.WriteLine($"Text: {response.Text}");