示例#1
0
 private void setCurrentVoice(VoicePersona voice)
 {
     currentVoice  = availableVoices.Where(azv => azv.ShortName == voice.VoiceName).FirstOrDefault();
     speed         = voice.Speed;
     semitonePitch = voice.SemitoneAdjust;
     if (voice.Mood != VoiceMood.Unavailable)
     {
         mood = voice.Mood;
     }
 }
示例#2
0
        private VoicePersona convertAzureVoice(AzureVoice azv)
        {
            var voice = new VoicePersona(this, azv.ShortName, charLimit, Enum.Parse <VoiceSex>(azv.Gender), int.Parse(azv.SampleRateHertz));

            if (azv.ShortName == "en-US-AriaNeural")
            {
                voice.Mood = mood;
            }
            voice.SemitoneAdjust = semitonePitch;
            voice.Speed          = speed;
            return(voice);
        }
示例#3
0
        public AzureVoiceProvider(ILogger logger, IConfiguration configuration)
        {
            this.logger        = logger;
            this.configuration = configuration;
            azureVoiceConfig   = configuration.GetSection("AzureVoiceConfig").Get <AzureVoiceConfig>();
            speechConfig       = SpeechConfig.FromSubscription(azureVoiceConfig.SubscriptionKey, azureVoiceConfig.Region);
            speechConfig.SetProfanity(ProfanityOption.Raw);
            speechConfig.SetProperty("SpeechServiceResponse_Synthesis_WordBoundaryEnabled", "false");
            tokenIssueTime = DateTime.Now;
            var allVoices = getAvailableVoices().GetAwaiter().GetResult();

            availableVoices = allVoices.Where(v => v.Locale.StartsWith(language));
            currentVoice    = availableVoices.FirstOrDefault();
        }