MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / norm_interp_f0

Function norm_interp_f0

utils/pitch_utils.py:45–60  ·  view source on GitHub ↗
(f0, hparams)

Source from the content-addressed store, hash-verified

43
44
45def 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
63def denorm_f0(f0, uv, hparams, pitch_padding=None, min=None, max=None):

Callers 2

__getitem__Method · 0.90
__getitem__Method · 0.90

Calls 1

norm_f0Function · 0.85

Tested by

no test coverage detected