howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

Feature request: Logarithmic fade

Open suterma opened this issue 3 years ago • 3 comments

For a music oriented project I am using howler.js with good success so far. However, I want to offer fading, and also maybe what is called "crossfading" and a logarithmic fading function would suit my needs best.

However, howler.js does only offer a linear fading function.

Now, for the Audio API variant this would be easy, just enable the logarithmic fade on the gain node. For the HTML5 player, which is most relevant to me, a custom implementation of the fade function would be necessary.

Are you positive about such a feature? Should I try an implementation and offer it to you?

suterma avatar Dec 30 '21 21:12 suterma

I second this. Came here today to file a feature request about using the exponential ramp instead of the linear for fades. Or maybe ideally, the option to choose what ramp to use.

The exponential ramp creates a much more natural fade in/out. The linear is frankly horrible.

NOTE! The exponential ramp doesn't accept 0 (zero) value so when fading out a floating number close to zero must be used.

image

nookerai avatar Jun 14 '22 14:06 nookerai

Hi I am facing the same issue today, I would like to use a more energy preserved fade in/out (for crossfading). The best for me would be to inject my own function... @suterma how did you solve your issue finally?

francois-spectre avatar Dec 05 '23 15:12 francois-spectre

@francois-spectre I abandoned howler.js for other reasons and eventually implemented a very simple (still linear) fading on HTML media elements myself. See https://github.com/suterma/replayer-pwa/blob/main/src/code/media/AudioFader.ts if you are interested.

suterma avatar Dec 05 '23 22:12 suterma