Skip to content

Commit

Permalink
[src] _reorder_sources() in OLA compares scaled/windowed frame with u…
Browse files Browse the repository at this point in the history
…n-scaled/un-windowed frame (asteroid-team#688)

* _reorder_sources() is called on the current and the previous frame. 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.

* Update asteroid/dsp/overlap_add.py

---------

Co-authored-by: Pariente Manuel <[email protected]>
  • Loading branch information
hendriks73 and mpariente authored Jan 24, 2024
1 parent 23f30e0 commit 08ffc2a
Showing 1 changed file with 6 additions and 3 deletions.
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)
else:
frame = frame / (self.window_size / self.hop_size)
out.append(frame)
frame /= self.window_size / self.hop_size

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

0 comments on commit 08ffc2a

Please sign in to comment.