Quick Start

You can explore reference implementations in the Resemble Examples repository. For a complete streaming walk-through, check resemble-ai/resemble-streaming-demo.

Set Up Your Environment

  1. Create a Resemble account if you have not already.
  2. Generate an API key from the Account → API page.
  3. Scaffold a Python project and install the official SDK:
$pip install resemble
  1. Authenticate and synthesize your first clip:
1#!/usr/bin/env python3
2"""
3Sample script demonstrating how to use the Resemble AI create_direct method.
4
5The create_direct method allows you to synthesize speech directly - this is useful for quick synthesis tasks.
6
7Requirements:
8- Resemble AI API key
9- Project UUID
10- Voice UUID
11"""
12
13from resemble import Resemble
14
15def main():
16 # Set your API key - get this from https://app.resemble.ai/account/api
17 API_KEY = "YOUR_API_KEY"
18
19 # Set your project and voice UUIDs
20 PROJECT_UUID = "YOUR_PROJECT_UUID"
21 VOICE_UUID = "YOUR_VOICE_UUID"
22
23 # Initialize the Resemble client with your API key
24 Resemble.api_key(API_KEY)
25
26 # Text to synthesize
27 data = "Hello, this is a sample text being synthesized using the create_direct method."
28
29 #Alternatively, you can pass in SSML to the data parameter.
30 #data = "<speak prompt=\"Speak in a British accent like you are from the heart of London, England.\">Hello, this is a sample text being synthesized using the create_direct endpoint.</speak>"
31
32 try:
33 # Call the create_direct endpoint
34 response = Resemble.v2.clips.create_direct(
35 project_uuid=PROJECT_UUID, # Required: project UUID
36 voice_uuid=VOICE_UUID, # Required: voice UUID
37 data=data, # Required: text to synthesize
38 title="Direct Syn test", # Optional: title for the synthesis
39 precision="PCM_16", # Optional: audio precision
40 output_format="wav", # Optional: output format
41 sample_rate=48000 # Optional: sample rate in Hz
42 )
43
44 # - success: boolean indicating if the request was successful
45 if response.get('success'):
46 print("Synthesis successful!")
47 print(f"Response: {response}")
48 audio_content = response.get('audio_content') # Base64 encoded audio content. You can decode it to get the audio data.
49 else:
50 print("Synthesis failed")
51 print(f"Error: {response}")
52 except Exception as e:
53 print(f"An error occurred: {e}")
54
55if __name__ == "__main__":
56 main()

If you run into issues, email support@resemble.ai and include request IDs, timestamps, and sample payloads when possible.