(f0, hparams)
| 43 | |
| 44 | |
| 45 | def norm_interp_f0(f0, hparams): |
| 46 | is_torch = isinstance(f0, torch.Tensor) |
| 47 | if is_torch: |
| 48 | device = f0.device |
| 49 | f0 = f0.data.cpu().numpy() |
| 50 | uv = f0 == 0 |
| 51 | f0 = norm_f0(f0, uv, hparams) |
| 52 | if sum(uv) == len(f0): |
| 53 | f0[uv] = 0 |
| 54 | elif sum(uv) > 0: |
| 55 | f0[uv] = np.interp(np.where(uv)[0], np.where(~uv)[0], f0[~uv]) |
| 56 | uv = torch.FloatTensor(uv) |
| 57 | f0 = torch.FloatTensor(f0) |
| 58 | if is_torch: |
| 59 | f0 = f0.to(device) |
| 60 | return f0, uv |
| 61 | |
| 62 | |
| 63 | def denorm_f0(f0, uv, hparams, pitch_padding=None, min=None, max=None): |
no test coverage detected