コード例 #1
0
        public static Guid SVEnrollSpeaker(SpeakerVerificationService svService, EnrollSpeaker enrollSpeaker)
        {
            // Open the sound file and load it in
            var speakerVerificationEnroll1 = File.OpenRead(enrollSpeaker.enrollFile1);
            var speakerVerificationEnroll2 = File.OpenRead(enrollSpeaker.enrollFile2);
            var speakerVerificationEnroll3 = File.OpenRead(enrollSpeaker.enrollFile3);

            // Create the new profile
            Console.WriteLine("Create new profile for Speaker 1");
            Task <Guid> newProfile = svService.CreateNewProfile("en-us");

            newProfile.Wait();
            Guid id = newProfile.Result;

            Console.WriteLine("Done");
            Console.WriteLine("");

            // Enroll the speaker
            Console.WriteLine("Enroll Speaker: " + id);
            svService.EnrollUser(speakerVerificationEnroll1, id).Wait();
            svService.EnrollUser(speakerVerificationEnroll2, id).Wait();
            svService.EnrollUser(speakerVerificationEnroll3, id).Wait();
            Console.WriteLine("Done");
            Console.WriteLine("");

            return(id);
        }
コード例 #2
0
        public static async Task RecVoiceTwo()
        {
            Console.WriteLine("recording for only 10secs");
            await player.Record();

            System.Threading.Thread.Sleep(10000);
            await player.StopRecording();

            EnrollSpeaker.EnrollVoice(VarHolder.ProfileId);
        }
コード例 #3
0
        public static async Task RecVoiceOne(string nameDesc)
        {
            VarHolder.ProfileName = nameDesc.Split(":")[0];
            VarHolder.ProfileDesc = nameDesc.Split(":")[1];
            Console.WriteLine("You need to record two audio notes to enroll your voice");
            Console.WriteLine("recording for only 10secs");
            await player.Record();

            System.Threading.Thread.Sleep(10000);
            await player.StopRecording();

            profileId = await CreateSpeaker.CreateProfile();

            VarHolder.ProfileId = profileId;
            EnrollSpeaker.EnrollVoice(profileId);
        }
コード例 #4
0
        public Dictionary <string, Guid> EnrollSpeaker([FromBody] EnrollSpeaker enrollSpeaker)
        {
            var sb = new StringBuilder();

            // Create the service
            Console.WriteLine("Creating the Speaker Verification Service.");
            var svService = new SpeakerVerificationService(Constants.SPEAKER_RECOGNITION_KEY);

            Console.WriteLine("Done");
            Console.WriteLine("");

            // Enroll Speaker
            var output = new Dictionary <string, Guid>();

            output["guid"] = SpeakerVerificationMethods.SVEnrollSpeaker(svService, enrollSpeaker);
            return(output);
        }