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

select a random sub-region of the noise based on the delta duration #1317

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lhotse/cut/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -3562,9 +3562,15 @@ def noise_gen():
# Keep sampling until we mixed in a "duration" amount of noise.
# Note: we subtract 0.05s (50ms) from the target duration to avoid edge cases
# where we mix in some noise cut that effectively has 0 frames of features.
while mixed_in_duration < target_mixed_duration:
while mixed_in_duration < (
target_mixed_duration - 0.05
osadj marked this conversation as resolved.
Show resolved Hide resolved
if self.duration is None
else target_mixed_duration
):
to_mix = next(mix_in_cuts)
to_mix = self._maybe_truncate_cut(to_mix, target_mixed_duration - mixed_in_duration, rng)
to_mix = self._maybe_truncate_cut(
to_mix, target_mixed_duration - mixed_in_duration, rng
)
# Keep the SNR constant for each cut from "self".
mixed = mixed.mix(
other=to_mix,
Expand Down
Loading