File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ """Lists the available voices."""
3
+ from google .cloud import texttospeech
4
+ from google .cloud .texttospeech import enums
5
+ client = texttospeech .TextToSpeechClient ()
6
+
7
+ # Performs the list voices request
8
+ voices = client .list_voices ()
9
+
10
+ for voice in voices .voices :
11
+ # Display the voice's name. Example: tpc-vocoded
12
+ print ('Name: {}' .format (voice .name ))
13
+
14
+ # Display the supported language codes for this voice. Example: "en-US"
15
+ for language_code in voice .language_codes :
16
+ print ('Supported language: {}' .format (language_code ))
17
+
18
+ ssml_gender = enums .SsmlVoiceGender (voice .ssml_gender )
19
+
20
+ # Display the SSML Voice Gender
21
+ print ('SSML Voice Gender: {}' .format (ssml_gender .name ))
22
+
23
+ # Display the natural sample rate hertz for this voice. Example: 24000
24
+ print ('Natural Sample Rate Hertz: {}\n ' .format (
25
+ voice .natural_sample_rate_hertz ))
You can’t perform that action at this time.
0 commit comments