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

_reorder_sources() in OLA compares scaled/windowed frame with un-scaled/un-windowed frame #688

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
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
9 changes: 6 additions & 3 deletions asteroid/dsp/overlap_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ def ola_forward(self, x):
# we determine best perm based on xcorr with previous sources
frame = _reorder_sources(frame, out[-1], n_src, self.window_size, self.hop_size)

out.append(frame)

# apply windowing/scaling *after* _reorder_sources has been called, inplace.
for frame in out:
if self.use_window:
frame = frame * self.window.to(frame)
frame *= self.window.to(frame)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a functional change, only cosmetic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, *= acts in-place, so the frame tensor itself gets modified, meaning that the frame in the out list is also modified.

frame = frame * self.window.to(frame) would not accomplish this, would it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I misread the logic at first, thanks.

else:
frame = frame / (self.window_size / self.hop_size)
out.append(frame)
frame /= self.window_size / self.hop_size
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.


out = torch.stack(out).reshape(n_chunks, batch * n_src, self.window_size)
out = out.permute(1, 2, 0)
Expand Down
Loading