File size: 507 Bytes
1018204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from elevenlabs import ElevenLabs

# Initialize the ElevenLabs client with your API key
client = ElevenLabs(api_key="YOUR_API_KEY")

# Generate audio from text
audio = client.generate(
    text="Welcome to your mock interview. Let's start with your first question.",
    voice="Rachel",  # Choose a pre-existing voice or create a custom voice
    model="eleven_monolingual_v1"  # Use the English-optimized model
)

# Save the generated audio to a file
with open("output.mp3", "wb") as f:
    f.write(audio)