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());
        }
Example #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());
        }
Example #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());
        }
Example #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());
        }
        public MainPage()
        {
            InitializeComponent();

            recorder = new AudioRecorderService
            {
                StopRecordingOnSilence    = true,
                StopRecordingAfterTimeout = true,
                TotalAudioTimeout         = TimeSpan.FromSeconds(15)          // 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/");
            }

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

            //	if you need custom endpoint(s) you can do this:
            //speechClient.SpeechEndpoint = new Endpoint ("westus.stt.speech.microsoft.com", "/speech/recognition");
            //speechClient.AuthEndpoint = new Endpoint ("westus.api.cognitive.microsoft.com", "/sts/v1.0/issueToken");

            BindingContext = this;
        }