clean excitation

pull/8/head
Jean-Marc Valin 2018-08-22 23:32:36 -04:00
parent b06be6066e
commit 850101634a
No known key found for this signature in database
GPG Key ID: 5E5DD9A36F9189C8
2 changed files with 7 additions and 6 deletions

View File

@ -66,7 +66,7 @@ in_data = np.reshape(in_data, (nb_frames*pcm_chunk_size, 1))
out_data = np.reshape(data, (nb_frames*pcm_chunk_size, 1))
model.load_weights('wavenet4a1_13.h5')
model.load_weights('wavenet4a3_30.h5')
order = 16

View File

@ -35,17 +35,18 @@ nb_used_features = wavenet.nb_used_features
feature_chunk_size = 15
pcm_chunk_size = frame_size*feature_chunk_size
data = np.fromfile(pcm_file, dtype='int16')
data = np.minimum(127, lin2ulaw(data/32768.))
udata = np.fromfile(pcm_file, dtype='int16')
data = np.minimum(127, lin2ulaw(udata/32768.))
nb_frames = len(data)//pcm_chunk_size
features = np.fromfile(feature_file, dtype='float32')
data = data[:nb_frames*pcm_chunk_size]
udata = udata[:nb_frames*pcm_chunk_size]
features = features[:nb_frames*feature_chunk_size*nb_features]
in_data = np.concatenate([data[0:1], data[:-1]]);
noise = np.concatenate([np.zeros((len(data)//3)), np.random.randint(-2, 2, len(data)//3), np.random.randint(-1, 1, len(data)//3)])
noise = np.concatenate([np.zeros((len(data)*2//5)), np.random.randint(-2, 2, len(data)//5), np.random.randint(-1, 1, len(data)*2//5)])
in_data = in_data + noise
in_data = np.maximum(-127, np.minimum(127, in_data))
@ -77,7 +78,7 @@ in_pitch = np.reshape(pitch/16., (nb_frames, pcm_chunk_size, 1))
in_data = np.reshape(in_data, (nb_frames, pcm_chunk_size, 1))
in_data = (in_data.astype('int16')+128).astype('uint8')
out_data = np.reshape(lin2ulaw((32768*ulaw2lin(data)-upred)/32768), (nb_frames, pcm_chunk_size, 1))
out_data = np.reshape(lin2ulaw((udata-upred)/32768), (nb_frames, pcm_chunk_size, 1))
out_data = np.maximum(-127, np.minimum(127, out_data))
out_data = (out_data.astype('int16')+128).astype('uint8')
features = np.reshape(features, (nb_frames, feature_chunk_size, nb_features))
@ -93,7 +94,7 @@ in_data = np.concatenate([in_data, pred], axis=-1)
# f.create_dataset('data', data=in_data[:50000, :, :])
# f.create_dataset('feat', data=features[:50000, :, :])
checkpoint = ModelCheckpoint('wavenet4a1_{epoch:02d}.h5')
checkpoint = ModelCheckpoint('wavenet4a3_{epoch:02d}.h5')
#model.load_weights('wavernn1c_01.h5')
model.compile(optimizer=Adam(0.001, amsgrad=True, decay=2e-4), loss='sparse_categorical_crossentropy', metrics=['sparse_categorical_accuracy'])