private BingSpeech()
        {
#if !PORTABLE
            this.MicrophoneService = new MicrophoneService();
#endif
            this.BingSpeechService = new BingSpeechService();
        }
        public TodoItemPage()
        {
            InitializeComponent();

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform);
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
        }
 private void InitSpeechService()
 {
     try {
         bingSpeechService = new BingSpeechService(new AuthenticationService(Secrets.SpeechApiKey), Device.RuntimePlatform);
     } catch (Exception ex) {
         Device.BeginInvokeOnMainThread(async() => {
             await DisplayAlert("Cannot initialize speech service", ex.Message, "OK");
         });
     }
 }
Esempio n. 4
0
        public AddPage()
        {
            InitializeComponent();
            Context = this.BindingContext as AddPageViewModel;

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform);
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));

            audioRecordingService = new AudioRecorderService();
        }
Esempio n. 5
0
        public TodoItemPage(TodoItem item)
        {
            InitializeComponent();
            this.BackgroundColor = Color.FromHex("#FFFFFF");
            this.reteived        = item;
            BindingContext       = item;

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.OS.ToString());
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
        }
 public SpeechTranslationController(IAzureSpeechTranslatorService azureSpeechTranslatorService,
                                    IAzureTextTranslationService azureTextTranslatorSevice,
                                    IBingSpeechService bingSpeechService,
                                    IWatsonTextTranslationService watsonTranslationService,
                                    IWatsonSpeechToTextService watsonSpeechToTextService)
 {
     _azureSpeechTranslatorService = azureSpeechTranslatorService;
     _azureTextTranslatorService   = azureTextTranslatorSevice;
     _bingSpeechService            = bingSpeechService;
     _watsonTextTranslationService = watsonTranslationService;
     _watsonSpeechToTextService    = watsonSpeechToTextService;
 }
        public FeedbackViewModel(
            ICameraService cameraService,
            IEmotionService emotionService,
            IBingSpeechService bingSpeechService)
        {
            _cameraService     = cameraService;
            _emotionService    = emotionService;
            _bingSpeechService = bingSpeechService;

            _description = new ValidatableObject <string>();

            AddValidations();
        }
Esempio n. 8
0
        public Distracted(StudyBlock studyBlockItem)
        {
            InitializeComponent();

            bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey));

            Padding = new Thickness(10, 0, 10, 0);

            Reason.FontSize = 12;

            StudyBlock model = new StudyBlock
            {
                StartTime = studyBlockItem.StartTime,
                EndTime   = studyBlockItem.EndTime,
                Topic     = studyBlockItem.Topic,
                Location  = studyBlockItem.Location,
                Goal      = studyBlockItem.Goal,
            };

            NavigationPage.SetHasBackButton(this, false);


            Boom.Clicked += async(sender, args) =>
            {
                Boom.IsVisible        = false;
                model.EndTime        += DateTime.Now.ToString("T");
                Results.IsVisible     = true;
                Results.FormattedText = CheckGoalStatus(model);
                SpeechArea.IsVisible  = true;
                await AzureManager.AzureManagerInstance.PostStudyBlockInformation(model);
            };


            Home.Clicked += async(sender, args) =>
            {
                await Navigation.PopToRootAsync();
            };
        }
 public MainPageViewModel(IDependencyService dependencyService)
 {
     _dependencyService = dependencyService;
     bingSpeechService  = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.OS.ToString());
 }
 public SpeechToTextController(IBingSpeechService bingSpeechService, IWatsonSpeechToTextService watsonSpeechToTextService, IAwsService awsService)
 {
     _bingSpeechService         = bingSpeechService;
     _watsonSpeechToTextService = watsonSpeechToTextService;
     _awsService = awsService;
 }
Esempio n. 11
0
        public HomePage()
        {
            InitializeComponent();

            bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform);

            _speechlist = new List <SpeechItem>
            {
                new SpeechItem
                {
                    SpeechText = "How can I help you?",
                    Speaker    = "CaSI"
                }
            };

            SpeechList.SeparatorColor = Color.Transparent;
            SpeechList.ItemsSource    = _speechlist;
            SpeechList.ItemSelected  += SpeechList_ItemSelected;
            SpeechList.HasUnevenRows  = true;

            var speakButton = new Button
            {
                Text = "Speak"
            };

            var languageButton = new Button
            {
                Text = "Default Language"
            };

            languageButton.Clicked += async(sender, args) =>
            {
                var locales = CrossTextToSpeech.Current.GetInstalledLanguages();
                var items   = locales.Select(a => a.ToString()).ToArray();


                var selected = await this.DisplayActionSheet("Language", "OK", null, items);

                if (string.IsNullOrWhiteSpace(selected) || selected == "OK")
                {
                    return;
                }
                languageButton.Text = selected;

                if (Device.RuntimePlatform == Device.iOS)
                {
                    locale = locales.FirstOrDefault(l => l.ToString() == selected);
                }
                else
                {
                    locale = new CrossLocale {
                        Language = selected
                    }
                };                                                   //fine for iOS/WP
            };

            var volume = 1.0;

            if (Device.RuntimePlatform == Device.iOS)
            {
                volume = 20.0;
            }


            sliderPitch  = new Slider(0, 2.0, 1.5);
            sliderRate   = new Slider(0, 1.0, .35);
            sliderVolume = new Slider(0, 2.0, volume);

            var useDefaults = new Switch
            {
                IsToggled = false
            };

            speakButton.Clicked += (sender, args) =>
            {
                if (useDefaults.IsToggled)
                {
                    TextSpeaker(_speechlist[0].SpeechText);
                    return;
                }
            };

            ListView _listview = new ListView
            {
                SeparatorColor = Color.Transparent,
                // Source of data items.
                ItemsSource = _speechlist,

                // Define template for displaying each item.
                // (Argument of DataTemplate constructor is called for
                //      each item; it must return a Cell derivative.)
                ItemTemplate = new DataTemplate(() =>
                {
                    // Create views with bindings for displaying each property.
                    Label speechLabel  = new Label();
                    Label speakerLabel = new Label();
                    speechLabel.SetBinding(Label.TextProperty, "SpeechText");
                    speakerLabel.SetBinding(Label.TextProperty, "Speaker");

                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Padding = new Thickness(0, 5),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                speechLabel,
                                speakerLabel
                            }
                        }
                    });
                })
            };

            controlslayout = new StackLayout
            {
                Padding         = 10,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Children        = { new Label {
                                        Text = "Pitch"
                                    },
                                    sliderPitch,
                                    new Label        {
                                        Text = "Speak Rate"
                                    },
                                    sliderRate,
                                    new Label        {
                                        Text = "Volume"
                                    },
                                    sliderVolume,
                                    new Label        {
                                        Text = "Use Defaults"
                                    },
                                    useDefaults,
                                    languageButton,
                                    speakButton, }
            };

            converseButton = new Button
            {
                Text = "Conversation"
            };

            converseButton.Clicked += (sender, args) =>
            {
                listviewlayout.IsVisible = true;
                controlslayout.IsVisible = false;
            };

            controlsButton = new Button
            {
                Text = "Controls"
            };
            controlsButton.Clicked += (sender, args) =>
            {
                listviewlayout.IsVisible = false;
                controlslayout.IsVisible = true;
            };

            controlsButton.Clicked += (sender, args) =>
            {
                listviewlayout.IsVisible = false;
                controlslayout.IsVisible = true;
            };
        }
Esempio n. 12
0
 public SpeechRecognition()
 {
     InitializeComponent();
     bingSpeechService = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey));
 }