3 hours ago · Tech · 0 comments

xAI has just released an API to clone your voice. It is pretty simple, read a script, and then an API where you can have text to speech in that voice. Here is the python code after you have cloned your voice. import osimport requestsvoice_id = os.environ['ANDY1_VOICE'] # my demo voice IDtext = '''this is a test demo of my voice. Be excited! OK, how about a list of things; one, two, three. Lets see where this takes us.'''response = requests.post( "https://api.x.ai/v1/tts", headers={ "Authorization": f"Bearer {os.environ['XAI_API_KEY']}", "Content-Type": "application/json", }, json={ "text": llm_book, "voice_id": voice_id, "language": "en", },)response.raise_for_status()with open("AndyTest1.mp3", "wb") as f: f.write(response.content) I need to figure out my audio set up a bit better (my mic set up is probably not optimal and it produces some echo). But does a good job imitating my boring voice right out of the box! And here is an example for longer speech from my intro to LLMs book: #…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.