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 multithreading #27

Open
joshinils opened this issue Jun 3, 2024 · 0 comments
Open

Add multithreading #27

joshinils opened this issue Jun 3, 2024 · 0 comments

Comments

@joshinils
Copy link

joshinils commented Jun 3, 2024

I've noticed that the loop Getting silent intervals to cut at

for i, values in tqdm(
enumerate(absolute_signal),
desc="Getting silent intervals to cut",
total=len(absolute_signal),
):
silence = all([value < magnitude_threshold for value in values])
silence_counter += silence
failure_counter += not silence
if failure_counter >= failure_tolerance:
if silence_counter >= duration_threshold:
interval_end = (i - failure_counter) / self.fps
interval_start = interval_end - (silence_counter / self.fps)
interval_start += space_on_edges
interval_end -= space_on_edges
intervals_to_cut.append(
(abs(interval_start), interval_end)
) # in seconds
silence_counter = 0
failure_counter = 0

Only uses one thread.

The same goes for Cutting silent intervals:

for start, stop in tqdm(intervals_to_cut, desc="Cutting silent intervals"):
clip_before = self.clip.subclip(previous_stop, start)
if clip_before.duration > self.min_loud_part_duration:
jumpcutted_clips.append(clip_before)
if self.silence_part_speed is not None:
silence_clip = self.clip.subclip(start, stop)
silence_clip = speedx(
silence_clip, self.silence_part_speed
).without_audio()
jumpcutted_clips.append(silence_clip)
previous_stop = stop

That also only uses one thread.

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