Ejemplo n.º 1
0
        public MainWindow()
        {
            api = new SpeechApi();

            InitializeComponent();

            string currentCulture = Thread.CurrentThread.CurrentCulture.Name;

            if (currentCulture.Equals("pt-BR"))
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("pt-BR");
            }
            else
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en");
            }

            api.api.SpeakProgress  += Api_SpeakProgress;
            api.api.SpeakStarted   += Api_SpeakStarted;
            api.api.SpeakCompleted += Api_SpeakCompleted;


            api.EventFired += Api_EventFired;


            speechViewControl = new SpeechViewControl();
            setupViewControl  = new SetupViewControl(api);

            ContentA.Content = speechViewControl;
            ContentB.Content = setupViewControl;

            SetupShow(Properties.Settings.Default.IsSetupVisible);
        }
Ejemplo n.º 2
0
        private static async Task <int> RunEnrollAndReturnExitCode(EnrollOptions opts)
        {
            SpeechApi.Initialize(
                new SpeechApi.Builder()
                .SetDeveloperKey(opts.DeveloperKey)
                .SetApplicationKey(opts.ApplicationKey)
                .SetApplicationSource("Dynamic.Speech.Samples")
                .SetLogger(Logger)
                .Build()
                );

            if (string.IsNullOrEmpty(opts.Path) || !Directory.Exists(opts.Path))
            {
                Logger.LogError("No Enrollment Directory Found for ClientId: {0}", opts.ClientId);
                return(1);
            }

            string[] enrollmentFiles = Directory.GetFiles(opts.Path, "*.wav");
            if (enrollmentFiles == null || enrollmentFiles.Length == 0)
            {
                Logger.LogError("No Enrollment Files Found for ClientId Folder: {0}", opts.ClientId);
                return(1);
            }

            await PerformEnroll(opts, enrollmentFiles);

            return(0);
        }
Ejemplo n.º 3
0
        public SetupViewControl(SpeechApi api)
        {
            InitializeComponent();

            this.api = api;


            foreach (VoiceRate voice in api.Voices)
            {
                lvVoices.Items.Add(voice);
            }
            lvVoices.SelectedIndex = 0;

            sliderVolume.Value = api.Volume;

            cbFocus.IsChecked         = Properties.Settings.Default.IsFocus;
            cbStartupFocus.IsChecked  = Properties.Settings.Default.IsStartupFocus;
            cboShortcut.SelectedIndex = Properties.Settings.Default.ShortcutIndex;

            api.SetHotkeys(Properties.Settings.Default.ShortcutIndex);
        }
Ejemplo n.º 4
0
 public void AsrRecognizeTest()
 {
     SpeechApi.Recognize("8k.pcm");
     SpeechApi.Recognize("8k.wav");
 }