Node.js Workflow

Prerequisites

  • Resemble account with PRO plan or higher
  • API token (see Authentication)

1. Initialize the project

$npm init -y
>npm install @resemble/node

2. Configure the SDK

1// resemble-clone-voice/index.js
2import * as Resemble from "@resemble/node";
3
4const apiKey = process.env.RESEMBLE_API_KEY;
5
6if (!apiKey) {
7 console.error("Please set the RESEMBLE_API_KEY environment variable.");
8 process.exit(1);
9}
10
11Resemble.Resemble.setApiKey(apiKey);

3. Create the voice

1async function createVoice() {
2 const voiceName = "My Voice Clone";
3 const dataset = "https://example.com/dataset.zip"; // Replace with your dataset URL
4
5 console.log(`Submitting request to create voice: ${voiceName}`);
6
7 try {
8 const response = await Resemble.Resemble.v2.voices.create({
9 name: voiceName,
10 dataset_url: dataset,
11 });
12
13 if (response.success) {
14 const voice = response.item;
15 console.log(
16 `Created voice ${voice.uuid}. Current status: ${voice.status}`
17 );
18 } else {
19 console.error("Voice creation failed", response);
20 }
21 } catch (error) {
22 console.error("Error creating voice:", error);
23 }
24}
25
26createVoice();

Datasets must be publicly accessible and follow Resemble’s supported formats. Verify reachability with:

$curl -I https://url/to/your/dataset.zip

4. Run the script

$RESEMBLE_API_KEY=... node index.js

You’ll receive a response indicating the new voice UUID and the current training status (e.g., initializing). Monitor progress via the API or the Voices dashboard.

For a recordings-based workflow, see the custom voice with recordings guide.