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

Feature Request: Add show_progress Argument to Display Progress Bar Using tqdm During Effect Processing #824

Open
masaishi opened this issue Dec 19, 2024 · 0 comments

Comments

@masaishi
Copy link

Feature Request: Add show_progress Argument to Display Progress Bar Using tqdm During Effect Processing

Description

Processing long audio files with PyDub effects can take a significant amount of time. For example, processing 1-hour audio files may take more than 10 minutes depending on the applied effect. To improve the user experience, I propose adding an optional show_progress argument to display a progress bar using tqdm for supported functions.

This feature would be especially useful for effects such as strip_silence, where the processing involves looping through chunks of audio data. By integrating tqdm, users can visually track the progress of the operation.

If this change is approved, I would like to submit a pull request myself to implement this feature.

Example Code Change

@register_pydub_effect
def strip_silence(seg, silence_len=1000, silence_thresh=-16, padding=100, show_progress=False):
    if padding > silence_len:
        raise InvalidDuration("padding cannot be longer than silence_len")

    chunks = split_on_silence(seg, silence_len, silence_thresh, padding)
    crossfade = padding / 2

    if not len(chunks):
        return seg[0:0]

    if show_progress:
        from tqdm import tqdm
        chunks = tqdm(chunks, desc="Processing chunks")

    seg = chunks[0]
    for chunk in chunks[1:]:
        seg = seg.append(chunk, crossfade=crossfade)

    return seg

Expected Behavior

When show_progress=True, the function should display a progress bar using tqdm to indicate the completion status of processing.

Actual Behavior

Currently, there is no feedback on progress, which can make it difficult to estimate how long the process will take.

Proposed Functions for Progress Bar Integration

  • Any other PyDub effects that involve iteration over chunks or frames
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

1 participant