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

Fade Out at end of sound, rather than whole duration? #674

Open
Patronics opened this issue Jan 9, 2025 · 1 comment
Open

Fade Out at end of sound, rather than whole duration? #674

Patronics opened this issue Jan 9, 2025 · 1 comment
Labels

Comments

@Patronics
Copy link

Patronics commented Jan 9, 2025

Is there any way to apply a fade-out to the end of a tone, rather than fading from the beginning through the end? This would better match the behavior of fade_in, which can be given a short duration to quickly fade the audio in. Providing fade_out a similarly short duration just leads to the tone rapidly fading out at the start, rather than doing a quick fade at the end.

Here's the project I'm working with using rodio, with the logic that almost works for the fading, except for the aforementioned issue with the fade_out. It's easier to hear the issue if you increase the TONE_DURATION constant to 5 seconds, where it's very clear the fade isn't behaving as desired.

@dvdsk
Copy link
Collaborator

dvdsk commented Jan 10, 2025

Yes you can but its not particularly clear how to do that. It could do with an example, I'll go ahead and add one.

Looking into it yes its possible by duplicating your source and using skip_duration and take_duration. I found that a little troublesome especially since skip duration takes some time since it literally skips every single sample until its gets to the right point.

I wrote a new source #675 for this, this also adds an example for fadeout_end. It does still need review and discussion by the other maintainers.

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

No branches or pull requests

2 participants