SuperAPI AI Directory

add-sound-effect

Design & creation

View repository

Updated 10-16 07:58

About this skill

Add Sound Effect

Add a new sound effect WAV file to the remotion-media project.

Required information

Ask the user for:

  1. Output filename (e.g. bruh.wav)
  2. Source file path (e.g. /Users/jonathanburger/Downloads/source.mp3)
  3. Attribution source URL

Steps

  1. Detect peak volume of the source file:

    ffmpeg -i <source> -af "volumedetect" -f null - 2>&1 | grep max_volume
    
  2. Calculate gain adjustment: target is -3dB peak. If current max is X dB, apply (-3 - X) dB gain.

  1. Convert to WAV with gain adjustment, 44100 Hz sample rate, PCM 16-bit:

    ffmpeg -i <source> -af "volume=<adjustment>dB" -c:a pcm_s16le -ar 44100 <project_root>/<output_filename> -y
    
  2. Trim trailing silence using silence detection:

    ffmpeg -i <output> -af "silencedetect=noise=-40dB:d=0.1" -f null - 2>&1 | grep silence
    

    If there is trailing silence (silence_start near the end), trim the file to just after the last non-silent section (add ~0.15s padding after the last sound):

    ffmpeg -i <output> -t <trim_point> -c:a pcm_s16le -ar 44100 <output_trimmed> -y && mv <output_trimmed> <output>
    
  3. Verify the output peaks at -3dB:

    ffmpeg -i <output> -af "volumedetect" -f null - 2>&1 | grep max_volume
    
  4. Add entry to the soundEffects array in generate.ts:

    {
      fileName: "<output_filename>",
      attribution: "<description> -- <source_url>",
    },
    

    Insert before the closing ]; of the soundEffects array.