/// <summary> /// Creates a new stream and starts the recording. /// </summary> public async Task GetNextRecording() { mSttStream = mSttClient.CreateStream(); mAudioCapture.Start(); Console.ReadLine(); await StopRecordingAsync(); }
private void startSpeechRecognition() { isFeeding = true; stream = client.CreateStream(); var feedCount = 0; var decodeRate = 100; // decode every 100 feeds Task.Run(async() => { while (isFeeding || !bufferQueue.IsEmpty) { if (!bufferQueue.IsEmpty && bufferQueue.TryDequeue(out short[] buffer)) { client.FeedAudioContent(stream, buffer, Convert.ToUInt32(buffer.Length)); if (++feedCount % decodeRate == 0) { var transcription = client.IntermediateDecode(stream); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { result.Text = transcription; }); } } } }); }