MCPcopy Create free account
hub / github.com/HumeAI/hume-api-examples / SendAudioChunksAsync

Function SendAudioChunksAsync

evi/evi-dotnet-quickstart/Program.cs:130–157  ·  view source on GitHub ↗
(IChatApi chatApi, byte[][] chunks, int chunkDurationMs)

Source from the content-addressed store, hash-verified

128}
129
130static async Task SendAudioChunksAsync(IChatApi chatApi, byte[][] chunks, int chunkDurationMs)
131{
132 Console.WriteLine($"Sending {chunks.Length} audio chunks...");
133
134 var lastLogTime = DateTime.Now;
135 long bytesSent = 0;
136
137 for (int i = 0; i < chunks.Length; i++)
138 {
139 var data = Convert.ToBase64String(chunks[i]);
140 await chatApi.Send(new AudioInput { Data = data });
141
142 bytesSent += chunks[i].Length;
143
144 // Log progress every 5 seconds
145 var now = DateTime.Now;
146 if ((now - lastLogTime).TotalSeconds >= 5)
147 {
148 Console.WriteLine($"Sent {bytesSent} bytes ({i + 1}/{chunks.Length} chunks)");
149 lastLogTime = now;
150 }
151
152 await Task.Delay(chunkDurationMs);
153 }
154
155 Console.WriteLine("Finished sending audio.");
156 Console.WriteLine($"Total bytes sent: {bytesSent}");
157}

Callers 1

TransmitTestAudioFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected