@@ -23,10 +23,35 @@ export enum SynthesisVoiceGender {
2323}
2424
2525export enum SynthesisVoiceType {
26+ /**
27+ * Voice type is not known.
28+ */
29+ Unknown = 0 ,
30+
31+ /**
32+ * Online neural voices.
33+ */
2634 OnlineNeural = 1 ,
35+
36+ /**
37+ * Online standard voices. These voices are deprecated.
38+ */
2739 OnlineStandard = 2 ,
40+
41+ /**
42+ * Offline neural voices.
43+ */
2844 OfflineNeural = 3 ,
45+
46+ /**
47+ * Offline standard voices.
48+ */
2949 OfflineStandard = 4 ,
50+
51+ /**
52+ * High definition (HD) voices. Refer to https://learn.microsoft.com/azure/ai-services/speech-service/high-definition-voices
53+ */
54+ OnlineNeuralHD = 5 ,
3055}
3156
3257const GENDER_LOOKUP : Record < string , SynthesisVoiceGender > = {
@@ -35,6 +60,11 @@ const GENDER_LOOKUP: Record<string, SynthesisVoiceGender> = {
3560 [ SynthesisVoiceGender [ SynthesisVoiceGender . Female ] ] : SynthesisVoiceGender . Female ,
3661} ;
3762
63+ const VOICE_TYPE_LOOKUP : Record < string , SynthesisVoiceType > = {
64+ Neural : SynthesisVoiceType . OnlineNeural ,
65+ NeuralHD : SynthesisVoiceType . OnlineNeuralHD ,
66+ } ;
67+
3868/**
3969 * Information about Speech Synthesis voice
4070 * Added in version 1.20.0.
@@ -66,7 +96,7 @@ export class VoiceInfo {
6696 this . privLocaleName = json . LocaleName ;
6797 this . privDisplayName = json . DisplayName ;
6898 this . privLocalName = json . LocalName ;
69- this . privVoiceType = json . VoiceType . endsWith ( "Standard" ) ? SynthesisVoiceType . OnlineStandard : SynthesisVoiceType . OnlineNeural ;
99+ this . privVoiceType = VOICE_TYPE_LOOKUP [ json . VoiceType ] || SynthesisVoiceType . Unknown ;
70100 this . privGender = GENDER_LOOKUP [ json . Gender ] || SynthesisVoiceGender . Unknown ;
71101
72102 if ( ! ! json . StyleList && Array . isArray ( json . StyleList ) ) {
0 commit comments