(cwt_spec, mean, std, cwt_scales)
| 133 | |
| 134 | |
| 135 | def cwt2f0(cwt_spec, mean, std, cwt_scales): |
| 136 | assert len(mean.shape) == 1 and len(std.shape) == 1 and len(cwt_spec.shape) == 3 |
| 137 | import torch |
| 138 | if isinstance(cwt_spec, torch.Tensor): |
| 139 | f0 = inverse_cwt_torch(cwt_spec, cwt_scales) |
| 140 | f0 = f0 * std[:, None] + mean[:, None] |
| 141 | f0 = f0.exp() # [B, T] |
| 142 | else: |
| 143 | f0 = inverse_cwt(cwt_spec, cwt_scales) |
| 144 | f0 = f0 * std[:, None] + mean[:, None] |
| 145 | f0 = np.exp(f0) # [B, T] |
| 146 | return f0 |
no test coverage detected