Skip to content

Commit

Permalink
clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
jmvalin committed Oct 3, 2023
1 parent f983e9a commit 95c1416
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dnn/torch/fargan/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self,
self.features = np.lib.stride_tricks.as_strided(self.features, shape=(self.nb_sequences, self.sequence_length*2+4, nb_features),
strides=(self.sequence_length*self.nb_features*sizeof, self.nb_features*sizeof, sizeof))
#self.periods = np.round(50*self.features[:,:,self.nb_used_features-2]+100).astype('int')
self.periods = np.round(256./2**(self.features[:,:,self.nb_used_features-2]+1.5)).astype('int')
self.periods = np.round(np.clip(256./2**(self.features[:,:,self.nb_used_features-2]+1.5), 32, 255)).astype('int')

self.lpc = self.features[:, :, self.nb_used_features:]
self.features = self.features[:, :, :self.nb_used_features]
Expand Down
2 changes: 1 addition & 1 deletion dnn/torch/fargan/fargan.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(self, feature_dim=20, cond_size=256, pembed_dims=12):
self.feature_dim = feature_dim
self.cond_size = cond_size

self.pembed = nn.Embedding(225, pembed_dims)
self.pembed = nn.Embedding(224, pembed_dims)
self.fdense1 = nn.Linear(self.feature_dim + pembed_dims, 64, bias=False)
self.fconv1 = nn.Conv1d(64, 128, kernel_size=3, padding='valid', bias=False)
self.fconv2 = nn.Conv1d(128, 80*4, kernel_size=3, padding='valid', bias=False)
Expand Down
2 changes: 1 addition & 1 deletion dnn/torch/fargan/test_fargan.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
lpc = features[:,4-1:-1,nb_used_features:]
features = features[:, :, :nb_used_features]
#periods = np.round(50*features[:,:,nb_used_features-2]+100).astype('int')
periods = np.round(256./2**(features[:,:,nb_used_features-2]+1.5)).astype('int')
periods = np.round(np.clip(256./2**(features[:,:,nb_used_features-2]+1.5), 32, 255)).astype('int')


nb_frames = features.shape[1]
Expand Down

0 comments on commit 95c1416

Please sign in to comment.