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); }
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); }
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); }
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); }