Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthesis Lengths #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
options:
--hparams=<parmas> Hyper parameters [default: ].
--preset=<json> Path of preset parameters (json).
--length=<T> Steps to generate [default: 32000].
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we drop the default parameter then I don' think

length = int(args["--length"])

will work, since None cannot be converted to int.

--length=<T> Steps to generate.
--initial-value=<n> Initial value for the WaveNet decoder.
--conditional=<p> Conditional features path.
--symmetric-mels Symmetric mel.
Expand Down Expand Up @@ -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.
Expand All @@ -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 if length is None else length
else:
# (Tc, D)
if c.ndim != 2:
Expand All @@ -89,8 +88,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:
Expand Down