Esempio n. 1
0
        /// <summary>
        /// Gets text from an audio stream.
        /// </summary>
        /// <param name="audiostream"></param>
        /// <returns>Transcribed text. </returns>
        public async Task <string> GetTextFromAudioAsync(Stream audiostream)
        {
            var text = await BingSpeech.GetTextFromAudioAsync(audiostream);

            Debug.WriteLine(text);
            return(text);
        }
Esempio n. 2
0
        private async Task OnRecordCompleted(RecordOutcomeEvent recordOutcomeEvent)
        {
            var id = Guid.NewGuid().ToString();

            recordOutcomeEvent.ResultingWorkflow.Actions = new List <ActionBase>
            {
                GetPromptForText(Message_Ending),
                new Hangup {
                    OperationId = id
                }
            };

            // Convert the audio to text
            if (recordOutcomeEvent.RecordOutcome.Outcome == Outcome.Success)
            {
                var    record = await recordOutcomeEvent.RecordedContent;
                string sst    = await BingSpeech.GetTextFromAudioAsync(record);
                await SendSTTResultToUser($"We detected the following audio: {sst}");
            }

            recordOutcomeEvent.ResultingWorkflow.Links = null;
            _callStateMap.Remove(recordOutcomeEvent.ConversationResult.Id);
        }