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

Add step_fun curve to fade() #532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bugsalad
Copy link

@bugsalad bugsalad commented Nov 2, 2020

Adds a function to fade(), in order to control the fade curve (other than the current linear fade).

Apologies for sending an untested pull; I'm unsure about testing without messing with my pip installation.

In any case, this is intended as a suggestion; you may want to change the public interface to something friendlier.
No need to credit authorship.

Thanks!

@bugsalad
Copy link
Author

bugsalad commented Dec 4, 2020

AppVeyor tests apparently broken:

Start-FileDownloadInternal : Error downloading remote file: One or more errors occurred.
Inner Exception: The remote name could not be resolved: 'ffmpeg.zeranoe.com'
At C:\Program Files\AppVeyor\BuildAgent\Modules\build-worker-api\build-worker-api.psm1:242 char:2

@GreyAlien502
Copy link
Collaborator

Thanks for the commit, @bugsalad.

For testing, you can just go to the test directory and run python tests.py.
There is a symlink in there to the repo's pydub code that will override whatever version you have installed.
We should probably add some basic tests so we know if this feature ever gets broken.

For the appveyor problem, i've submitted bug fix #526,
which still needs to be reviewed before it can be merged.

This feature would facilitate implementation of equal power crossfade as requested in #508.

The concern i have with your implementation is that the choice for stepping by millisecond or by frame is based on the duration,
so if the derivative of step_fun is too high, you can get audible clicks at millisecond boundaries.
E.g.: this will step by millisecond:

sound.fade(to_gain=10,duration=200,step_fun=lambda x: x*10 if x<.1 else 1)

, but this will step by frame:

sound.fade(to_gain=10,duration=20)

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

Successfully merging this pull request may close these issues.

None yet

2 participants