Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Audio Volume Amplification Beyond 1.0 in Remotion (Willing to help with this) #4603

Open
mileslow opened this issue Dec 5, 2024 · 1 comment

Comments

@mileslow
Copy link

mileslow commented Dec 5, 2024

Feature Request: Allow Audio Volume Amplification Beyond 1.0 🔊

Use Case

Currently, Remotion's <Audio/> component limits volume control to a range of 0-1, which only allows for volume reduction but not amplification. There are common scenarios where users need to increase the volume of audio clips beyond their original levels:

  • Working with audio clips that were recorded at low volumes
  • Balancing audio levels between different clips in a composition
  • Creating emphasis/dramatic effect by temporarily boosting certain audio segments
  • Compensating for volume differences between music tracks and voice-overs

Possible Solution

Modify the <Audio/> component to:

  1. Allow the volume prop to accept values greater than 1.0 (maybe a max of 3.0)
  2. Implement volume amplification using the Web Audio API under the hood
  3. Add optional props for controlling amplification behavior:

<Audio src={audioFile} volume={2.5} // Allow values > 1.0 maxVolume={3.0} // Optional cap on maximum volume preventClipping={true} // Optional flag to prevent audio distortion />

Technical Implementation Details

  • Use Web Audio API's GainNode for volume manipulation
  • Add safeguards against extreme amplification that could cause distortion
  • Maintain backward compatibility with existing volume behavior
  • Add warning in dev mode when volume exceeds 1.0 to help prevent unintended loud audio

Benefits

  • Gives users more control over audio levels
  • Reduces need for external audio preprocessing
  • Simplifies workflow for balancing audio in complex compositions
  • Maintains Remotion's ease-of-use while adding powerful functionality

Considerations

  • Need to handle potential audio clipping/distortion, especially regarding decibel conversion
  • Browser compatibility with Web Audio API
  • Performance impact of audio processing
  • Clear documentation about responsible usage of amplification
@JonnyBurger
Copy link
Member

Thank your for this idea, it is great one!

During rendering, it is already possible using the allowAmplificationDuringRender prop (https://www.remotion.dev/docs/audio/#allowamplificationduringrender).

It would indeed be super nice if using the Web Audio API, this would also be possible during preview!

If you would like to experiment with this, I would be very happy to work with you on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants