Azure Cognitive Services TTS - an error for other language in sample app

蹲街弑〆低调 提交于 2019-12-11 06:47:46

问题


I wanted to implement an api call for Azure Cognitive Services TTS. And by courtesy of @Md Farid Uddin Kiron stackoverflow user and the question that we discussed on this link So, I pulled down an sample code that is an .netcore web app which communicates with Azure. Sample link is here

I have a following problem: The app works perfectly with predefined languages in a model such as:

    public List<SelectListItem> LanguagePreference { get; set; } = new List<SelectListItem>
    {
       new SelectListItem { Value = "NA", Text = "-Select-" },
       new SelectListItem { Value = "en-US", Text = "English (United States)"  },
       new SelectListItem { Value = "en-IN", Text = "English (India)"  },
       new SelectListItem { Value = "ta-IN", Text = "Tamil (India)"  },
       new SelectListItem { Value = "hi-IN", Text = "Hindi (India)"  },
       new SelectListItem { Value = "te-IN", Text = "Telugu (India)"  }
    };

but when I add for example an italian language (it-IT, hr-HR - those are language codes for fields Value), the code breaks in HomeController on method Translate.


回答1:


I have reproduce your problem successfully.

As per my findings there are some key points to language supports like:

  1. Subscription Free subscription doesn't allow all language

  2. Region of Support

  3. var requestBody = this.GenerateSsml(lang, "Female", this.ServiceName(lang), content);

Note: language that doesn't support Female also can be the issue.

Your Case:

In your code you could try with below code at LanguagePreference list

 new SelectListItem { Value = "es-ES", Text = "es-ES,(Spanish)"  }

Also Change on below code under ServiceName I have tested with Spanish which works fine.

 values.Add("es-ES", "Microsoft Server Speech Text to Speech Voice (es-ES, Laura, Apollo)");

Point To Remember:

Our code base is alright. problem is not related to code. Please be sure your subscriptions and region support translation you are trying. can also rise your support ticket on azure portal.



来源:https://stackoverflow.com/questions/57158760/azure-cognitive-services-tts-an-error-for-other-language-in-sample-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!