Exemple #1
0
        private void buttonStopRecord_Click(object sender, EventArgs e)
        {
            buttonStopRecord.Enabled         = false;
            pictureBoxSpinner.Visible        = true;
            labelRecordingInProgress.Visible = false;

            _transcriber.StopRecording();

            this.backgroundWorkerTranscribe.RunWorkerAsync();
        }
Exemple #2
0
        //
        static void Main(string[] args)
        {
            string model    = null;
            string scorer   = null;
            string audio    = null;
            bool   extended = true;

            model    = GetArgument(args, "--model");
            scorer   = GetArgument(args, "--scorer");
            audio    = GetArgument(args, "--audio");
            extended = !string.IsNullOrWhiteSpace(GetArgument(args, "--extended"));

            DeepSpeechTranscriber _transcriber;

            try
            {
                _transcriber = new DeepSpeechTranscriber(model: model,
                                                         kenlm_scorer: scorer);
            }
            catch (Exception exc)
            {
                Console.Out.WriteLine(exc.Message);
                Console.Out.WriteLine("Pwyswch 'Return' i gau'r rhaglen.");
                Console.In.ReadLine();
                return;
            }


            List <string> sttResult;

            if (!String.IsNullOrEmpty(audio))
            {
                _transcriber.AddRecording(audio);
                sttResult = _transcriber.Transcribe();
                foreach (String r in sttResult)
                {
                    Console.Out.WriteLine(r);
                }
            }
            else
            {
                Console.Out.WriteLine("Adnabod lleferydd o'r microffon");
                while (true)
                {
                    Console.Out.WriteLine(Environment.NewLine);
                    Console.Out.WriteLine("Pwyswch 'Return' i ddechrau recordio...");
                    Console.In.ReadLine();

                    Console.Out.WriteLine("Yn recordio... pwyswch 'Return' i stopio'r recordio.");

                    _transcriber.StartRecording();

                    Console.In.ReadLine();
                    _transcriber.StopRecording();

                    sttResult = _transcriber.Transcribe();
                    foreach (String r in sttResult)
                    {
                        Console.Out.WriteLine(r);
                    }
                }
            }
        }