diff --git a/vocos/heads.py b/vocos/heads.py index 181865f..21863f1 100644 --- a/vocos/heads.py +++ b/vocos/heads.py @@ -54,10 +54,15 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: mag, p = x.chunk(2, dim=1) mag = torch.exp(mag) mag = torch.clip(mag, max=1e2) # safeguard to prevent excessively large magnitudes + # wrapping happens here. These two lines produce real and imaginary value x = torch.cos(p) y = torch.sin(p) - phase = torch.atan2(y, x) - S = mag * torch.exp(phase * 1j) + # recalculating phase here does not produce anything new + # only costs time + # phase = torch.atan2(y, x) + # S = mag * torch.exp(phase * 1j) + # better directly produce the complex value + S = mag * (x + 1j * y) audio = self.istft(S) return audio