public MainPage()
        {
            InitializeComponent();

            //setting these in XAML doesn't seem to be working
            RecognitionModePicker.SelectedIndex = 0;
            OutputModePicker.SelectedIndex      = 0;
            ProfanityModePicker.SelectedIndex   = 0;

            recorder = new AudioRecorderService
            {
                StopRecordingOnSilence    = true,
                StopRecordingAfterTimeout = true,
                TotalAudioTimeout         = TimeSpan.FromSeconds(15)          //Bing speech REST API has 15 sec max
            };

            if (Keys.BingSpeech.SubscriptionKey == Keys.BingSpeech.BadSubscriptionKey)
            {
                throw new Exception("Get a Bing Speech API key here: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/speech-api/");
            }

            bingSpeechClient = new BingSpeechApiClient(Keys.BingSpeech.SubscriptionKey);

            //go fetch an auth token up front - this should decrease latecy on the first call.
            //	Otherwise, this would be called automatically the first time I use the speech client
            Task.Run(() => bingSpeechClient.Authenticate());
        }
Esempio n. 2
0
        public SayItPage()
        {
            InitializeComponent();
            recorder = new AudioRecorderService
            {
                StopRecordingOnSilence    = true,                    //will stop recording after 2 seconds of silence
                StopRecordingAfterTimeout = true,                    //stop recording after a max timeout
                TotalAudioTimeout         = TimeSpan.FromSeconds(10) //audio will stop recording after 15 seconds
            };

            bingSpeechClient = new BingSpeechApiClient(""); //insert bingspeech api key here

            //go fetch an auth token up front - this should decrease latecy on the first call.
            //	Otherwise, this would be called automatically the first time I use the speech client
            Task.Run(() => bingSpeechClient.Authenticate());
        }
Esempio n. 3
0
        public TodoItemListViewModel()
        {
            //recorder = new Plugin.AudioRecorder.AudioRecorderService()
            //{
            //    StopRecordingOnSilence = true,
            //    StopRecordingAfterTimeout = true,
            //    TotalAudioTimeout = TimeSpan.FromSeconds(10)
            //};

            SpeakItemCommand      = new Command(SpeakItem);
            NewTodoItemCommand    = new Command(AddNewItem);
            UpdateTodoItemCommand = new Command <TodoItemViewModel>(UpdateItem);

            bingSpeechClient = new BingSpeechApiClient("68c55c3ad7f1435f841ee128b903c822");

            //go fetch an auth token up front - this should decrease latecy on the first call.
            //	Otherwise, this would be called automatically the first time I use the speech client
            Task.Run(() => bingSpeechClient.Authenticate());
        }
Esempio n. 4
0
        public MainPage()
        {
            InitializeComponent();

            //setting these in XAML doesn't seem to be working
            //RecognitionModePicker.SelectedIndex = 0;
            //OutputModePicker.SelectedIndex = 0;
            //ProfanityModePicker.SelectedIndex = 0;

            recorder = new AudioRecorderService
            {
                StopRecordingOnSilence    = true,
                StopRecordingAfterTimeout = true,
                TotalAudioTimeout         = TimeSpan.FromSeconds(15)          //Bing speech REST API has 15 sec max
            };

            bingSpeechClient = new BingSpeechApiClient(Keys.BingSpeech.SubscriptionKey);

            //go fetch an auth token up front - this should decrease latecy on the first call.
            //	Otherwise, this would be called automatically the first time I use the speech client
            Task.Run(() => bingSpeechClient.Authenticate());
        }