adapt.auto_duck takes a music track and a voice recording and delivers one finished mix, with the music turned down (“ducked”) whenever the voice is speaking so every word stays clear. Use it for adverts, explainers, podcast intros, narrated video and anywhere else a voice talks over music.
You don’t need to balance the two recordings first. In one step:
- the voice is levelled, so it sits at the same level whether it was recorded quietly or loudly;
- the music is placed underneath it, at a level that leaves room for the speech;
- the music is ducked while speech is detected, and comes back up when it stops;
- the mix is delivered at a target loudness: -14 LUFS unless you ask for another, with its true peak at or below -1 dBTP.
The request
Every field, with its exact rules: submit and poll in the API Reference.
Example
This mixes a voiceover over a music bed for a podcast intro, delivered with thepodcast preset (-16 LUFS). It uses the reference client; save soundpiece.py or soundpiece.mjs next to it first.
The result
run returns the finished ducked_audio object:
The source URLs are never echoed back.
Choosing parameters
- Length. The mix is as long as the longer input. The shorter one is padded with silence at its end, so nothing is cut off. To end the music with the voice, trim the music to length first, for example with
adapt.auto_cut_down. - Loudness. Pick the preset for where the mix is going:
streaming(-14 LUFS, the default) for online video and social media,podcast(-16 LUFS) for podcast feeds,broadcast(-23 LUFS) for EBU R128 television and radio. Or send{"target_lufs": ...}for another number between -30 and -6. The loudness normalisation guide has a fuller table. allow_compressionworks as it does everywhere: on by default, so the mix lands on the target; set it tofalseto keep the dynamics untouched, at the cost of landing a little quieter when the audio is very dynamic. See Loudness.- Inputs. A clean voice recording, without its own music under it, gives the best result. The music can be any finished track or bed; you don’t need to turn it down beforehand.
Errors
When you submit (the request is refused, nothing is charged):
While processing (the operation finishes as
failed, with an error.code):
For a
source_* error, error.source says which input it concerns, "music" or "voice", when that is known:
401, 403, 429).
