Skip to main content
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

file
required
Audio file to add music to (MP3, WAV, etc.)
file
required
Background music file (MP3, WAV, etc.)
number
default:"-20"
Music volume in decibels (dB). Range: -40 to 0
  • Lower values = quieter music
  • Higher values = louder music
  • Default: -20 dB (background level)
integer
default:"2000"
Fade in/out duration in milliseconds. Default: 2000ms (2 seconds)
string
required
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

  1. The music file is adjusted to the specified volume
  2. If the music is shorter than the audio, it’s looped to match the length
  3. Music is trimmed to exactly match the audio duration
  4. Fade in/out effects are applied for smooth transitions
  5. The voice and music are combined into a single audio file

Tips

  • Use instrumental music to avoid conflicts with voice
  • Adjust music_volume to ensure the voice remains clear
  • Longer fade_duration creates smoother transitions
  • The music will automatically loop if shorter than the audio