Skip to content

Instantly share code, notes, and snippets.

@lewangdev
Created October 24, 2023 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lewangdev/b28f42f2f672245419b9f52d7c525c17 to your computer and use it in GitHub Desktop.
Save lewangdev/b28f42f2f672245419b9f52d7c525c17 to your computer and use it in GitHub Desktop.
Get Edge TTS Voice Name List
import asyncio
from edge_tts import list_voices
async def print_voices() -> None:
"""Print all available voices."""
voices = await list_voices()
voices = sorted(voices, key=lambda voice: voice["ShortName"])
print("| Name | Gender | Language |")
print("| :--- | :----- | :--------|")
for idx, voice in enumerate(voices):
if idx != 0:
pass
cols = None
for key in voice.keys():
if key in (
"SuggestedCodec",
"FriendlyName",
"Status",
"VoiceTag",
"Name",
"Locale",
):
continue
pretty_key_name = key if key != "ShortName" else "Name"
if pretty_key_name == 'Name':
cols = []
cols.append(voice[key])
if pretty_key_name == 'Gender':
print(f"| {cols[0]} | {cols[1]} | {'-'.join(cols[0].split('-')[0:2])} |")
if __name__ == "__main__":
asyncio.run(print_voices())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment