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

Conversation

hendriks73
Copy link
Contributor

Hey there,

_reorder_sources() is called with the current and the previous frames as arguments. The way it had been coded, the previous frame might have been scaled or windowed already. But to get best results, we probably want to compare to an unscaled, un-windowed version. That's what this change fixes.

Cheers.

…he way it had been coded, the previous frame might have been scaled or windowed already. But to get best results, we probably want to compare to an unscaled, un-windowed version.
@mpariente
Copy link
Collaborator

Hey,
Thanks for the contribution.

Look at the diff, because you changed other things (formating), the diff is much less clear. Can you change only the functional part of the code you intend to change please ?

@hendriks73
Copy link
Contributor Author

Looked at the diff—I don't think I have changed the formatting. 🤷‍♂️

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.

@mpariente
Copy link
Collaborator

You are right, it was functional because of the inplace modification I didn't get.

Merging.

@mpariente mpariente merged commit 08ffc2a into asteroid-team:master Jan 24, 2024
4 checks passed
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.

2 participants