private readonly VoiceToText _voiceToText; //Speech recognition from cognative services public MainWindow() { UiLog.Info("bio info UI started"); InitializeComponent(); _messageSide = MessageSide.BioInfoSide; Messages = new MessageCollection { new Message { Side = MessageSide.BioInfoSide, Text = "Welcome to the B,M,S, Bio Info A,I Terminal. How may I help you today?" } }; _updater = new BioInfoUpdater(); // version checks & updates _dialogHandler = new DialogHandler(this); // DialogHandler _bioInfoVoice = new SpeechSynthesizer(); _voiceToText = new VoiceToText(); DataContext = Messages; _scrollViewerScrollToEndAnim = new DoubleAnimation { Duration = TimeSpan.FromSeconds(1), EasingFunction = new SineEase() }; Storyboard.SetTarget(_scrollViewerScrollToEndAnim, this); Storyboard.SetTargetProperty(_scrollViewerScrollToEndAnim, new PropertyPath(_verticalOffsetProperty)); _scrollViewerStoryboard = new Storyboard(); _scrollViewerStoryboard.Children.Add(_scrollViewerScrollToEndAnim); Resources.Add("foo", _scrollViewerStoryboard); tbTextInput.Focus(); }
public MainWindow() { InitializeComponent(); _voiceToText = new VoiceToText(); SpeakBtn.Content = "Start Recording"; ResponceTxt.Background = Brushes.White; ResponceTxt.Foreground = Brushes.Black; }
private void btn2_Click(object sender, EventArgs e) { VoiceToText frm = new VoiceToText(); this.Hide(); frm.ShowDialog(); this.Show(); }
private async void VoiceCaptureButton_Click(object sender, RoutedEventArgs e) { string output; //开始录音 if (VoiceRecordSym == true) { _memoryBuffer = new InMemoryRandomAccessStream(); VoiceCaptureButton.FontFamily = new FontFamily("Segoe UI"); VoiceCaptureButton.Content = "停止录音"; VoiceRecordSym = false; if (IsRecording) { throw new InvalidOperationException("Recording already in progress!"); } MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings { StreamingCaptureMode = StreamingCaptureMode.Audio }; _mediaCapture = new MediaCapture(); await _mediaCapture.InitializeAsync(settings); //将录音文件存入_memoryBuffer里面 await _mediaCapture.StartRecordToStreamAsync(MediaEncodingProfile.CreateWav(AudioEncodingQuality.Auto), _memoryBuffer); IsRecording = true; } //停止录音 else { await _mediaCapture.StopRecordAsync(); IsRecording = false; VoiceCaptureButton.FontFamily = new FontFamily("Segoe MDL2 Assets"); VoiceCaptureButton.Content = "\xE1D6"; VoiceRecordSym = true; progessRing.IsActive = true; Input.IsReadOnly = true; //转换InMemoryRandomAccessStream成Stream Stream tempStream = WindowsRuntimeStreamExtensions.AsStreamForRead(_memoryBuffer.GetInputStreamAt(0)); using (var stream = new MemoryStream()) { tempStream.CopyTo(stream); VoiceToText voiceToText = new VoiceToText(); //传入VoiceToText函数 output = await voiceToText.ReadVoice(stream, "yue"); } //tempStream.Position = 0; progessRing.IsActive = false; Input.IsReadOnly = false; Input.Text += output; } }
/* [Header("PlayerInfo")] * public int Playerlives = 3; */ /* private void Awake() //Appliying Singleton for future Use * { * int numGameSessions = FindObjectsOfType<GameSession>().Length; * if(numGameSessions > 1) * { * Destroy(this.gameObject); * } * else * { * DontDestroyOnLoad(this.gameObject); * } * } */ void Start() { voicetotext = FindObjectOfType <VoiceToText>(); voiceScript = FindObjectOfType <VoiceMovement>(); keyboardscript = FindObjectOfType <PlayerMovementRB>(); LoseLabel.SetActive(false); InstructionsLabel.SetActive(true); ScoreLabel.SetActive(false); VoicetoTextLabel.SetActive(true); keyboardscript.enabled = true; }
public DictationEmail() { InitializeComponent(); _tbCtrl = TbDictation; _voiceToText = new VoiceToText(); _emailOperations = new EmailOperations(); _chemOperations = new ChemOperations(); _fullResponces = string.Empty; _partialResponces = string.Empty; _commandMode = false; }
private readonly int VOICE = 10; // This must be 10 because this plugin registered as 10 protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); VoiceToText.Init(this); // Need this to init LoadApplication(new App()); }
private void Awake() { audiosrc = GetComponent <AudioSource>(); voicetotext = FindObjectOfType <VoiceToText>(); rb = GetComponent <Rigidbody2D>(); PlayerLegsCollider = GetComponent <BoxCollider2D>(); PlayerBodyCollider = GetComponent <CapsuleCollider2D>(); anim = GetComponent <AnimationController>(); GravityatStart = rb.gravityScale; gameObject.transform.localScale = new Vector2(1, 1); StartCoroutine(DisbleInstuctionsLabel()); }
private void Start() { voicetotext = FindObjectOfType <VoiceToText>(); actions.Add("Start", StartGame); actions.Add("Quit", QuitGame); actions.Add("MainMenu", MenuScreen); actions.Add("Menu", MenuScreen); keywordRecognizer = new KeywordRecognizer(actions.Keys.ToArray()); keywordRecognizer.OnPhraseRecognized += RecognizedVoice; keywordRecognizer.Start(); }
public DictationEmail(bool record) { _commandMode = false; InitializeComponent(); _voiceToText = new VoiceToText(); _emailOperations = new EmailOperations(); _chemOperations = new ChemOperations(); _fullResponces = string.Empty; _partialResponces = string.Empty; _tbCtrl = TbEmailAddress; //begin recording immediately if (record) { StartRecording(); } }