Add Background Music
Text-to-Speech
Add Background Music
Add background music to an existing audio file
POST
Add Background Music
Add background music to an existing audio file. The music will be looped to match the audio length and faded in/out for smooth transitions.
Request
Audio file to add music to (MP3, WAV, etc.)
Background music file (MP3, WAV, etc.)
Music volume in decibels (dB). Range: -40 to 0
- Lower values = quieter music
- Higher values = louder music
- Default: -20 dB (background level)
Fade in/out duration in milliseconds. Default: 2000ms (2 seconds)
Your GistMag API key
Response
Returns the combined audio file (voice + music) as MP3.Credit Cost
1 credit per request (in addition to any credits used to generate the original audio).Example Request
How It Works
- The music file is adjusted to the specified volume
- If the music is shorter than the audio, it’s looped to match the length
- Music is trimmed to exactly match the audio duration
- Fade in/out effects are applied for smooth transitions
- The voice and music are combined into a single audio file
Tips
- Use instrumental music to avoid conflicts with voice
- Adjust
music_volumeto ensure the voice remains clear - Longer
fade_durationcreates smoother transitions - The music will automatically loop if shorter than the audio