This example assumes using AssemblyAI; is in scope and apiKey contains your AssemblyAI API key.
1 2 3 4 5 6 7 8 910111213141516
usingvarclient=GetAuthenticatedApi();ISpeechToTextClientspeechClient=client;// Transcribe audio using the MEAI ISpeechToTextClient interface.// The client uploads the audio stream and polls until transcription is complete.usingvarhttpClient=newHttpClient();awaitusingvaraudioStream=awaithttpClient.GetStreamAsync("https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3");varms=newMemoryStream();awaitaudioStream.CopyToAsync(ms);ms.Position=0;varresponse=awaitspeechClient.GetTextAsync(ms);Console.WriteLine($"Text: {response.Text}");