From 0beda75f22eacdae0f8058af09e8051595af370a Mon Sep 17 00:00:00 2001 From: Michael Petrochuk Date: Thu, 17 May 2018 10:01:10 -0700 Subject: [PATCH 1/3] Lengths Conditional synthesis does not respect the lengths parameter, rather it overrides it. This patch fixes that. --- synthesis.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/synthesis.py b/synthesis.py index 4daf877..d33916e 100644 --- a/synthesis.py +++ b/synthesis.py @@ -89,8 +89,12 @@ def wavegen(model, length=None, c=None, g=None, initial_value=None, assert c.ndim == 2 Tc = c.shape[0] upsample_factor = audio.get_hop_size() - # Overwrite length according to feature size - length = Tc * upsample_factor + if length is None: + length = Tc * upsample_factor + else: + num_frames = int(length // upsample_factor) + length = num_frames * upsample_factor + c = c[:num_frames] # (Tc, D) -> (Tc', D) # Repeat features before feeding it to the network if not hparams.upsample_conditional_features: From 464b51ed2297764dbb3d336f189bfcbed4b4f5ad Mon Sep 17 00:00:00 2001 From: Michael Petrochuk Date: Sat, 19 May 2018 15:51:22 -0700 Subject: [PATCH 2/3] Update to be compatible. --- synthesis.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/synthesis.py b/synthesis.py index d33916e..85e87f3 100644 --- a/synthesis.py +++ b/synthesis.py @@ -7,7 +7,7 @@ options: --hparams= Hyper parameters [default: ]. --preset= Path of preset parameters (json). - --length= Steps to generate [default: 32000]. + --length= Steps to generate. --initial-value= Initial value for the WaveNet decoder. --conditional=

Conditional features path. --symmetric-mels Symmetric mel. @@ -58,8 +58,7 @@ def wavegen(model, length=None, c=None, g=None, initial_value=None, Args: model (nn.Module) : WaveNet decoder - length (int): Time steps to generate. If conditinlal features are given, - then this is determined by the feature size. + length (int): Time steps to generate. c (numpy.ndarray): Conditional features, of shape T x C g (scaler): Speaker ID initial_value (int) : initial_value for the WaveNet decoder. @@ -80,7 +79,7 @@ def wavegen(model, length=None, c=None, g=None, initial_value=None, model.make_generation_fast_() if c is None: - assert length is not None + length = 32000 else: # (Tc, D) if c.ndim != 2: From ac737a322eac29c861054c1bcc10fc1431dd5b7a Mon Sep 17 00:00:00 2001 From: Michael Petrochuk Date: Sat, 19 May 2018 15:52:13 -0700 Subject: [PATCH 3/3] if then --- synthesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthesis.py b/synthesis.py index 85e87f3..50bc6a1 100644 --- a/synthesis.py +++ b/synthesis.py @@ -79,7 +79,7 @@ def wavegen(model, length=None, c=None, g=None, initial_value=None, model.make_generation_fast_() if c is None: - length = 32000 + length = 32000 if length is None else length else: # (Tc, D) if c.ndim != 2: