jeevzz commited on
Commit
f1b9dc0
ยท
verified ยท
1 Parent(s): 21afc70

Update voice.py

Browse files
Files changed (1) hide show
  1. voice.py +48 -33
voice.py CHANGED
@@ -2,41 +2,56 @@ import edge_tts
2
  import tempfile
3
  import os
4
 
 
 
 
5
  async def generate_audio(text: str, voice: str) -> str:
6
- # Retry up to 3 times
7
- for attempt in range(3):
8
- try:
9
- communicate = edge_tts.Communicate(text, voice)
10
-
11
- # Create a temporary file
12
- fd, path = tempfile.mkstemp(suffix=".mp3")
13
- os.close(fd)
14
-
15
- await communicate.save(path)
 
 
 
16
 
17
- # Verify file size
18
- if os.path.getsize(path) > 0:
19
- return path
20
- except Exception as e:
21
- print(f"TTS Attempt {attempt+1} failed: {e}")
22
- if attempt == 2:
23
- raise e
24
- return path
25
 
26
  def get_voices():
27
- # Return a list of available voices (simplified)
 
 
 
28
  return [
29
- {"name": "Ana (Female)", "id": "en-US-AnaNeural"},
30
- {"name": "Andrew (Male)", "id": "en-US-AndrewMultilingualNeural"},
31
- {"name": "Aria (Female)", "id": "en-US-AriaNeural"},
32
- {"name": "Ava (Female)", "id": "en-US-AvaMultilingualNeural"},
33
- {"name": "Brian (Male)", "id": "en-US-BrianMultilingualNeural"},
34
- {"name": "Christopher (Male)", "id": "en-US-ChristopherNeural"},
35
- {"name": "Emma (Female)", "id": "en-US-EmmaMultilingualNeural"},
36
- {"name": "Eric (Male)", "id": "en-US-EricNeural"},
37
- {"name": "Guy (Male)", "id": "en-US-GuyNeural"},
38
- {"name": "Jenny (Female)", "id": "en-US-JennyNeural"},
39
- {"name": "Michelle (Female)", "id": "en-US-MichelleNeural"},
40
- {"name": "Roger (Male)", "id": "en-US-RogerNeural"},
41
- {"name": "Steffan (Male)", "id": "en-US-SteffanNeural"},
42
- ]
 
 
 
 
 
 
 
 
 
 
 
 
2
  import tempfile
3
  import os
4
 
5
+ # Use Microsoft Edge TTS - High quality neural voices
6
+ # Includes sexy, hot female voices with various accents
7
+
8
  async def generate_audio(text: str, voice: str) -> str:
9
+ """
10
+ Generate audio using Microsoft Edge TTS with high-quality neural voices
11
+ """
12
+ try:
13
+ # Create a temporary file with .mp3 extension
14
+ fd, path = tempfile.mkstemp(suffix=".mp3")
15
+ os.close(fd)
16
+
17
+ # Generate speech using edge-tts
18
+ communicate = edge_tts.Communicate(text, voice)
19
+ await communicate.save(path)
20
+
21
+ return path
22
 
23
+ except Exception as e:
24
+ print(f"TTS Failed: {e}")
25
+ raise e
 
 
 
 
 
26
 
27
  def get_voices():
28
+ """
29
+ Return curated list of sexy, hot female voices
30
+ Featuring Microsoft's best neural voices with various styles
31
+ """
32
  return [
33
+ # ๐Ÿ”ฅ HOTTEST FEMALE VOICES - Sexy & Sultry ๐Ÿ”ฅ
34
+ {"name": "๐Ÿ’‹ Aria (Sexy US) - HOTTEST", "id": "en-US-AriaNeural"},
35
+ {"name": "๐Ÿ’• Jenny (Seductive US)", "id": "en-US-JennyNeural"},
36
+ {"name": "โœจ Michelle (Flirty US)", "id": "en-US-MichelleNeural"},
37
+ {"name": "๐ŸŒน Ashley (Sweet US)", "id": "en-US-AshleyNeural"},
38
+ {"name": "๐Ÿ’– Sara (Warm US)", "id": "en-US-SaraNeural"},
39
+
40
+ # ๐Ÿ‡ฌ๐Ÿ‡ง British Accent - Elegant & Sophisticated
41
+ {"name": "๐Ÿ‘‘ Sonia (Sexy British)", "id": "en-GB-SoniaNeural"},
42
+ {"name": "๐ŸŽ€ Libby (Cute British)", "id": "en-GB-LibbyNeural"},
43
+ {"name": "๐Ÿ’ Mia (Sweet British)", "id": "en-GB-MiaNeural"},
44
+
45
+ # ๐Ÿ‡ฆ๐Ÿ‡บ Australian Accent - Fun & Playful
46
+ {"name": "๐ŸŒด Natasha (Aussie Babe)", "id": "en-AU-NatashaNeural"},
47
+ {"name": "โ˜€๏ธ Freya (Aussie Darling)", "id": "en-AU-FreyaNeural"},
48
+
49
+ # ๐Ÿ‡ฎ๐Ÿ‡ณ Indian Accent - Exotic & Beautiful
50
+ {"name": "๐ŸŒบ Neerja (Indian Beauty)", "id": "en-IN-NeerjaNeural"},
51
+
52
+ # ๐Ÿ‡จ๐Ÿ‡ฆ Canadian - Friendly & Approachable
53
+ {"name": "๐Ÿ Clara (Canadian Cutie)", "id": "en-CA-ClaraNeural"},
54
+
55
+ # ๐Ÿ‡ฎ๐Ÿ‡ช Irish Accent - Charming
56
+ {"name": "โ˜˜๏ธ Emily (Irish Charm)", "id": "en-IE-EmilyNeural"},
57
+ ]