Manage speaker separation for PVC samples to isolate individual speakers in multi-speaker recordings.
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient({ apiKey: "your-api-key" });
// Access this API via: client.voices.pvc.samples.speakersRetrieve the status of the speaker separation process and list of detected speakers.
/**
* @param voice_id - Voice ID
* @param sample_id - Sample ID
* @param requestOptions - Optional request configuration
* @returns Speaker separation status and detected speakers
* @throws UnprocessableEntityError if request fails
*/
client.voices.pvc.samples.speakers.get(
voice_id: string,
sample_id: string,
requestOptions?: RequestOptions
): HttpResponsePromise<SpeakerSeparationResponseModel>;
interface SpeakerSeparationResponseModel {
/** Voice ID */
voice_id: string;
/** Sample ID */
sample_id: string;
/** Status of speaker separation */
status: "not_started" | "pending" | "completed" | "failed";
/** Speakers of the sample */
speakers?: Record<string, SpeakerResponseModel>;
/** IDs of selected speakers */
selected_speaker_ids?: string[];
}
interface SpeakerResponseModel {
/** Speaker ID */
speaker_id: string;
/** Duration of speaker segment in seconds */
duration_secs: number;
/** Utterances of the speaker */
utterances?: UtteranceResponseModel[];
}
interface UtteranceResponseModel {
/** Start time of utterance in seconds */
start: number;
/** End time of utterance in seconds */
end: number;
}Start speaker separation process for a sample.
/**
* @param voice_id - Voice ID
* @param sample_id - Sample ID
* @param requestOptions - Optional request configuration
* @returns Separation start status
* @throws UnprocessableEntityError if request fails
*/
client.voices.pvc.samples.speakers.separate(
voice_id: string,
sample_id: string,
requestOptions?: RequestOptions
): HttpResponsePromise<StartSpeakerSeparationResponseModel>;
interface StartSpeakerSeparationResponseModel {
/** Status of start request ('ok' if successful) */
status: string;
}Retrieve the separated audio for a specific speaker.
/**
* @param voice_id - Voice ID
* @param sample_id - Sample ID
* @param speaker_id - Speaker ID
* @param requestOptions - Optional request configuration
* @returns Speaker audio in base64
* @throws UnprocessableEntityError if request fails
*/
client.voices.pvc.samples.speakers.audio.get(
voice_id: string,
sample_id: string,
speaker_id: string,
requestOptions?: RequestOptions
): HttpResponsePromise<SpeakerAudioResponseModel>;
interface SpeakerAudioResponseModel {
/** Base64 encoded audio */
audio_base64: string;
/** Media type of the audio */
media_type: string;
/** Duration in seconds */
duration_secs: number;
}