cnph001 commited on
Commit
d90ab58
·
verified ·
1 Parent(s): 5021a0c

fix for 8 Voices

Browse files

8 Voices:
Default = US-Andrew, other voices 1F:US_Emma, 2F:US_Jenny, 3F:HK_Jan, 1M:US_Roger, 2M:US_Bryan,3M:AU_William, 1C: Childvoice

Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -14,7 +14,7 @@ async def get_voices():
14
 
15
  # Text-to-speech function for a single paragraph
16
  async def paragraph_to_speech(text, voice, rate, pitch):
17
- voice1 ="en-US-AndrewNeural - en-US (Male)" #good for reading
18
  voice1F ="en-US-EmmaNeural - en-US (Female)"
19
  voice2 = "en-US-BrianNeural - en-US (Male)"
20
  voice2F = "en-US-JennyNeural - en-US (Female)"
@@ -34,10 +34,13 @@ async def paragraph_to_speech(text, voice, rate, pitch):
34
  voice_short_name =voice3F.split(" - ")[0]
35
  elif text.startswith("1M"):
36
  text2 = text[2:] # Remove the first two characters ("FF")
37
- voice_short_name =voice2.split(" - ")[0]
38
  elif text.startswith("2M"):
39
  text2 = text[2:] # Remove the first two characters ("FF")
40
- voice_short_name =voice3.split(" - ")[0]
 
 
 
41
  elif text.startswith("1C"):
42
  text2 = text[2:] # Remove the first two characters ("FF")
43
  voice_short_name =voice4.split(" - ")[0]
@@ -99,7 +102,7 @@ async def create_demo():
99
  voices = await get_voices()
100
  default_voice = "en-US-AndrewNeural - en-US (Male)" # 👈 Pick one of the available voices
101
  description = """
102
- Default = male, other voices 1F:US_Emma, 2F:US_Jenny, 3F:HK_Jan, 1M:US_Guy, 2M:AU_William, 1C: Childvoice
103
  Enter your text, select a voice, and adjust the speech rate and pitch.
104
  The application will process your text paragraph by paragraph (separated by two blank lines).
105
  """
 
14
 
15
  # Text-to-speech function for a single paragraph
16
  async def paragraph_to_speech(text, voice, rate, pitch):
17
+ voice1 ="en-US-RogerNeural - en-US (Male)" #good for reading
18
  voice1F ="en-US-EmmaNeural - en-US (Female)"
19
  voice2 = "en-US-BrianNeural - en-US (Male)"
20
  voice2F = "en-US-JennyNeural - en-US (Female)"
 
34
  voice_short_name =voice3F.split(" - ")[0]
35
  elif text.startswith("1M"):
36
  text2 = text[2:] # Remove the first two characters ("FF")
37
+ voice_short_name =voice1.split(" - ")[0]
38
  elif text.startswith("2M"):
39
  text2 = text[2:] # Remove the first two characters ("FF")
40
+ voice_short_name =voice2.split(" - ")[0]
41
+ elif text.startswith("3M"):
42
+ text2 = text[2:] # Remove the first two characters ("FF")
43
+ voice_short_name =voice3.split(" - ")[0]
44
  elif text.startswith("1C"):
45
  text2 = text[2:] # Remove the first two characters ("FF")
46
  voice_short_name =voice4.split(" - ")[0]
 
102
  voices = await get_voices()
103
  default_voice = "en-US-AndrewNeural - en-US (Male)" # 👈 Pick one of the available voices
104
  description = """
105
+ Default = male, other voices 1F:US_Emma, 2F:US_Jenny, 3F:HK_Jan, 1M:US_Roger, 2M:US_Bryan,3M:AU_William, 1C: Childvoice
106
  Enter your text, select a voice, and adjust the speech rate and pitch.
107
  The application will process your text paragraph by paragraph (separated by two blank lines).
108
  """