Проблема в работе с Azure Cognitive Services Speaker Recognition

я новичок в работе с ms Аzure, но у меня появилась следующая задача, при помощи Azure Cognitive Services Speaker Recognition подтвердить то, что говорящий соответствует известному или зарегистрированному голосу. На сайте microsoft есть статья с примером, как работать с речевым сервисом, но когда я запускаю пример он стопорится на функции SpeakerVerify и не может обработать результат оценки сходства (result = await speakerRecognizer.RecognizeOnceAsync(model)). С Аzure все синхронизируется. Пожалуйста, помогите разобраться в чем здесь проблема. Заранее спасибо.

namespace YMM7

{ public class Program {

    public static async Task VerificationEnroll(SpeechConfig config, Dictionary<string, string> profileMapping)
    {
        using (var client = new VoiceProfileClient(config))
        using (var profile = await client.CreateProfileAsync(VoiceProfileType.TextIndependentVerification, "en-us"))
        {
            using (var audioInput = AudioConfig.FromDefaultMicrophoneInput())
            {
                Console.WriteLine($"Enrolling profile id {profile.Id}.");
                // give the profile a human-readable display name
                profileMapping.Add(profile.Id, "Your Name");

                VoiceProfileEnrollmentResult result = null;
                while (result is null || result.RemainingEnrollmentsSpeechLength > TimeSpan.Zero)
                {
                    Console.WriteLine("Continue speaking to add to the profile enrollment sample.");
                    result = await client.EnrollProfileAsync(profile, audioInput);
                    Console.WriteLine($"Remaining enrollment audio time needed: {result.RemainingEnrollmentsSpeechLength}");
                    Console.WriteLine("");
                }

                if (result.Reason == ResultReason.EnrolledVoiceProfile)
                {
                    
                    await SpeakerVerify(config, profile, profileMapping);
                }
                else if (result.Reason == ResultReason.Canceled)
                {
                    var cancellation = VoiceProfileEnrollmentCancellationDetails.FromResult(result);
                    Console.WriteLine($"CANCELED {profile.Id}: ErrorCode={cancellation.ErrorCode} ErrorDetails={cancellation.ErrorDetails}");
                }
            }
        }
    }
    public static async Task SpeakerVerify(SpeechConfig config, VoiceProfile profile, Dictionary<string, string> profileMapping)
    {
        var speakerRecognizer = new SpeakerRecognizer(config, AudioConfig.FromDefaultMicrophoneInput());
        var model = SpeakerVerificationModel.FromProfile(profile);
        

        Console.WriteLine("Speak the passphrase to verify: \"My voice is my passport, verify me.\"");
       
        var result = await speakerRecognizer.RecognizeOnceAsync(model);
        
        Console.WriteLine($"Verified voice profile for speaker {profileMapping[result.ProfileId]}, score is {result.Score}");
    }
    static async Task Main(string[] args)
    {
        // replace with your own subscription key 
        string subscriptionKey = "subscription key";
        string region = "westus";
        var config = SpeechConfig.FromSubscription(subscriptionKey, region); 


        var profileMapping = new Dictionary<string, string>();
        await VerificationEnroll(config, profileMapping);

        Console.ReadLine();
    }

}

} введите сюда описание изображения


Ответы (0 шт):