Let’s start with a simple text-to-speech generation:
Copy
from audiopod import Client# Initialize clientclient = Client()# Generate speechresult = client.voice.generate_speech( voice_id="aura", text="Hello world! This is my first AudioPod AI generated voice.", language="en", audio_format="mp3", wait_for_completion=True)print(f"Audio generated: {result.output_url}")# Download the audio fileimport requestsaudio_response = requests.get(result.output_url)with open("hello_world.mp3", "wb") as f: f.write(audio_response.content)print("Audio saved as hello_world.mp3")
# Create a voice profile from audio samplevoice_profile = client.voice.create_voice_profile( name="My Custom Voice", voice_file="path/to/voice_sample.wav", description="A custom voice for my project", wait_for_completion=True)print(f"Voice profile created: {voice_profile.id}")# Use the new voice for speech generationcloned_speech = client.voice.generate_speech( voice_id=voice_profile.id, text="This is my cloned voice speaking!", wait_for_completion=True)print(f"Cloned speech: {cloned_speech.output_url}")
# Generate music from text promptmusic_job = client.music.generate_music( prompt="upbeat electronic dance music with heavy bass", duration=120.0, # 2 minutes wait_for_completion=True)print(f"Music generated: {music_job.output_url}")# Generate rap musicrap_job = client.music.generate_rap( lyrics="AudioPod AI, the future is here, Making music that's crystal clear", style="modern", tempo=120, wait_for_completion=True)print(f"Rap generated: {rap_job.output_url}")