elevenlabs dubbing

免费增值
通过 Thomcle | 已更新 2 mesi fa | Artificial Intelligence/Machine Learning
人气

8.4 / 10

延迟

27,362ms

服务等级

99%

Health Check

N/A

返回全部教程 (2)

Get background audio for better dubbing quality

The idea behind vocal removing

When you use this API to obtain the speech restranscription in another language of a source audio, you can’t simply replace the original speech with the generated one, so we propose this approach:

  1. Extract background noise from audio.

  2. Dub the audio with the API.

  3. Combine the two generated audios into one.

Here’s how these dynamic operations can be performed in Python.

Get the background sound of an audio with the API.

import requests

url = "https://elevenlabs-dubbing1.p.rapidapi.com/vocal_removal"

files = { "audio_file": open(AUDIO_FILE_PATH, "rb") }

headers = {
	"X-RapidAPI-Key": "YOUT_RAPIDAPI_KEY",
	"X-RapidAPI-Host": "elevenlabs-dubbing1.p.rapidapi.com"
}

response = requests.post(url, headers=headers, files=files)

with open(OUTPUT_FILE_PATH, "wb") as file:
    file.write(response.content)

Get dubbed audio in another language

Please refer to this tutorial.

Overlay audios with pydub.

background_noise = AudioSegment.from_file(BACKGROUND_NOISE_PATH)
speech = AudioSegment.from_file(SPEECH_PATH)

#You can adjust sound volumes in decibels if you wish to increase background or voice noise.
background_noise = background_noise - 10 #Reduce by 10 decibels
speech = speech + 10 #Increases by 10 decibels

#overlay audio
dubbed_audio = background_noise.overlay(speech)

#export audio
dubbed_audio.export(AUDIO_PATH)