Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit c9c8ead

Browse files
committed
2 parents 5beeaee + 40127ec commit c9c8ead

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

Samples/MicrophoneStream/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.Extensions.Configuration;
66

77
var transcriptWords = new SortedDictionary<int, string>();
8+
89
string BuildTranscript()
910
{
1011
var stringBuilder = new StringBuilder();
@@ -34,7 +35,8 @@ string BuildTranscript()
3435
});
3536

3637
transcriber.PartialTranscriptReceived.Subscribe(transcript =>
37-
{ // don't do anything if nothing was said
38+
{
39+
// don't do anything if nothing was said
3840
if (string.IsNullOrEmpty(transcript.Text)) return;
3941
transcriptWords[transcript.AudioStart] = transcript.Text;
4042

@@ -101,4 +103,4 @@ string BuildTranscript()
101103
}
102104

103105
soxProcess.Kill();
104-
await transcriber.CloseAsync();
106+
await transcriber.CloseAsync();

Samples/MicrophoneStream/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Transcribe audio from the microphone in real-time
2+
3+
The following things are required to run the sample:
4+
* [.NET 8 or up](https://dotnet.microsoft.com/en-us/download)
5+
* [Install SoX and add it to the PATH environment variable](https://sourceforge.net/projects/sox/)
6+
* An [AssemblyAI](https://www.assemblyai.com/dashboard/signup) account with credit card set up
7+
* Configure [your AssemblyAI API key](https://www.assemblyai.com/app/account) using .NET user-secrets:
8+
```bash
9+
dotnet user-secrets set AssemblyAI:ApiKey [YOUR_API_KEY]
10+
```
11+
12+
Now run the sample:
13+
14+
```bash
15+
dotnet run
16+
```
17+
18+
Speak into your microphone to see your speech transcribed in real-time.

Samples/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Samples for the AssemblyAI C# .NET SDK
2+
3+
This solution contains a variety of samples that show how to use the AssemblyAI SDK for C# .NET.
4+
5+
* [MicrophoneStream](./MicrophoneStream): A console app to transcribe speech from the microphone in real-time.
6+
* [Avalonia](./Avalonia): An Avalonia app that lets you transcribe audio files, prompt LLMs using LeMUR, and transcribe speech from the microphone in real-time.
7+
* [BlazorSample](./BlazorSample): A Blazor WASM and Server app that lets you transcribe audio files, prompt LLMs using LeMUR, and transcribe speech from the microphone in real-time.
8+
* [TwilioVoice](./TwilioVoice): An ASP.NET Core app that uses Twilio Media Streams to transcribe speech from Twilio Voice calls in real-time.

0 commit comments

Comments
 (0)