Exemplo n.º 1
0
        const int SPEAKER_RECOGNITION_API_INTERVAL = 3000;                    //Min time allowed between requests to speaker recognition API.

        public static void TestTranscription(string audioFileLoc)
        {
            /*Subscription key for Azure SpeakerRecognition service. */
            var speakerIDKey = "";           //Free tier key for testing

            FileInfo testRecording  = new FileInfo(audioFileLoc);
            FileInfo meetingMinutes = new FileInfo(@"../transcript/minutes.txt");

            //var voiceprints = MakeTestVoiceprints(testRecording);                   //Make a test set of voiceprint objects

            string userEmail = "*****@*****.**";

            var regCon = RegistrationController.BuildController("",
                                                                new List <string>()
            {
                userEmail
            });

            var speechConfig = SpeechConfig.FromSubscription("", "centralus");

            /*Setup the TranscribeController instance which manages the details of the transcription procedure */
            var controller = new TranscribeController(testRecording, regCon.UserProfiles, speechConfig);

            Console.WriteLine("Please press <Return> to continue.");
            Console.ReadLine();

            // performs transcription and speaker recognition
            if (controller.Perform())
            {
                controller.WriteTranscriptionFile();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs when DiScribe bot dials in to Webex meeting. Dials in to a Webex
        /// meeting and Performs transcription and speaker
        /// recognition. Then emails meeting transcript to all participants
        /// and updates the meeting record in DiScribe DB.
        /// </summary>
        /// <param name="appConfig"></param>
        /// <returns></returns>
        static int Run(MeetingInfo meetingInfo, IConfigurationRoot appConfig)
        {
            try
            {
                /*dialing & recording */
                var rid = new DialerController(appConfig).CallMeetingAsync(meetingInfo.AccessCode).Result;

                var recording = new RecordingController(appConfig).DownloadRecordingAsync(rid).Result;

                /*Make controller for accessing registered user profiles in Azure Speaker Recognition endpoint */
                var regController = RegistrationController.BuildController(appConfig["DB_CONN_STR"],
                                                                           EmailHelper.FromEmailAddressListToStringList(meetingInfo.AttendeesEmails), appConfig["SPEAKER_RECOGNITION_ID_KEY"]);

                /*initializing the transcribe controller */
                SpeechConfig speechConfig         = SpeechConfig.FromSubscription(appConfig["SPEECH_RECOGNITION_KEY"], appConfig["SPEECH_RECOGNITION_LOCALE"]);
                var          transcribeController = new TranscribeController(recording, regController.UserProfiles, speechConfig, appConfig["SPEAKER_RECOGNITION_ID_KEY"]);

                /*Performs transcription and speaker recognition. If success, then send email minutes to all participants */
                if (transcribeController.Perform())
                {
                    EmailSender.SendMinutes(meetingInfo, transcribeController.WriteTranscriptionFile(rid));
                    Console.WriteLine(">\tTask Complete!");
                }
                else
                {
                    EmailSender.SendEmail(meetingInfo, $"Failed to Generate Meeting Minutes for {meetingInfo.Subject}");
                    Console.WriteLine(">\tFailed to generate!");
                    return(-1);
                }

                /*Set meeting minutes contents and file location in the Meeting object */
                meetingInfo.Meeting.MeetingFileLocation = transcribeController.MeetingMinutesFile.FullName;
                meetingInfo.Meeting.MeetingMinutes      = transcribeController.Transcription;

                /*Sync meeting object with DiScribe DB */
                meetingInfo.Meeting.Update();



                return(0);
            }
            catch (AggregateException exs)
            {
                foreach (var ex in exs.InnerExceptions)
                {
                    Console.Error.WriteLine(ex.Message);
                }
                return(-1);
            }
            finally
            {
                try
                {
                    int max_size = 100;
                    Console.WriteLine("Recordings in total exceeds "
                                      + max_size + "Mb in size. Removing Oldest Recording\n["
                                      + DeleteOldestRecordingIfLargerThan(max_size) + "]");
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Could not remove oldest recording Reason: " + ex.Message);
                }
            }
        }