Skip to content

Audio edit

Replace part of a short WAV clip by submitting the original and target transcript text.

This example assumes using ResembleAI; is in scope and apiKey contains your ResembleAI API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
using var client = new ResembleAIClient(apiKey);
var fixture = GetPrimaryAudioFixture();
var selectedVoice = await GetEditableVoiceAsync(client);
var audioBytes = await LoadAudioFixtureAsync(fixture);

try
{
    // Submit an edit request that replaces the spoken text with new content.
    var audioEdit = await client.SubpackageAudioEdit.CreateAudioEditAsync(
        inputAudio: audioBytes,
        inputAudioname: fixture.FileName,
        originalTranscript: fixture.Transcript,
        targetTranscript: fixture.EditedTranscript,
        voiceUuid: selectedVoice.Uuid);

    Console.WriteLine($"Audio edit job: {audioEdit.Item?.Uuid}");

}
catch (ApiException ex)
{
    AssertFeatureAvailable(ex, "audio edit");
}