Documentation Index
Fetch the complete documentation index at: https://docs.gistmag.co.uk/llms.txt
Use this file to discover all available pages before exploring further.
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)
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
curl -X POST https://api.gistmag.co.uk/tts/add-music \
-F "audio=@speech.mp3" \
-F "music=@background.mp3" \
-F "music_volume=-20" \
-F "fade_duration=2000" \
-F "api_key=your_api_key_here" \
--output speech_with_music.mp3
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_volume to ensure the voice remains clear
- Longer
fade_duration creates smoother transitions
- The music will automatically loop if shorter than the audio