mirror of
https://github.com/xiph/opus.git
synced 2025-05-21 10:58:30 +00:00
Making it easier to change the frame size
This commit is contained in:
parent
38cd5cf08f
commit
dc082d7c1c
4 changed files with 7 additions and 5 deletions
|
@ -313,7 +313,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
last_silent = silent;
|
||||
}
|
||||
if (count>=5000000 && one_pass_completed) break;
|
||||
if (count*FRAME_SIZE_5MS>=10000000 && one_pass_completed) break;
|
||||
if (training && ++gain_change_count > 2821) {
|
||||
float tmp;
|
||||
speech_gain = pow(10., (-20+(rand()%40))/20.);
|
||||
|
|
|
@ -36,6 +36,7 @@ import numpy as np
|
|||
import h5py
|
||||
import sys
|
||||
|
||||
frame_size = 160
|
||||
pcm_bits = 8
|
||||
embed_size = 128
|
||||
pcm_levels = 2**pcm_bits
|
||||
|
@ -139,7 +140,7 @@ def new_lpcnet_model(rnn_units1=384, rnn_units2=16, nb_used_features = 38, use_g
|
|||
|
||||
cfeat = fdense2(fdense1(cfeat))
|
||||
|
||||
rep = Lambda(lambda x: K.repeat_elements(x, 160, 1))
|
||||
rep = Lambda(lambda x: K.repeat_elements(x, frame_size, 1))
|
||||
|
||||
if use_gpu:
|
||||
rnn = CuDNNGRU(rnn_units1, return_sequences=True, return_state=True, name='gru_a')
|
||||
|
@ -158,6 +159,7 @@ def new_lpcnet_model(rnn_units1=384, rnn_units2=16, nb_used_features = 38, use_g
|
|||
model.rnn_units1 = rnn_units1
|
||||
model.rnn_units2 = rnn_units2
|
||||
model.nb_used_features = nb_used_features
|
||||
model.frame_size = frame_size
|
||||
|
||||
encoder = Model([feat, pitch], cfeat)
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=
|
|||
|
||||
feature_file = sys.argv[1]
|
||||
out_file = sys.argv[2]
|
||||
frame_size = 160
|
||||
frame_size = model.frame_size
|
||||
nb_features = 55
|
||||
nb_used_features = model.nb_used_features
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ model.summary()
|
|||
|
||||
feature_file = sys.argv[1]
|
||||
pcm_file = sys.argv[2] # 16 bit unsigned short PCM samples
|
||||
frame_size = 160
|
||||
frame_size = model.frame_size
|
||||
nb_features = 55
|
||||
nb_used_features = model.nb_used_features
|
||||
feature_chunk_size = 15
|
||||
|
@ -97,7 +97,7 @@ del sig
|
|||
del pred
|
||||
|
||||
# dump models to disk as we go
|
||||
checkpoint = ModelCheckpoint('lpcnet20c_384_10_G16_{epoch:02d}.h5')
|
||||
checkpoint = ModelCheckpoint('lpcnet20g_384_10_G16_{epoch:02d}.h5')
|
||||
|
||||
#model.load_weights('lpcnet9b_384_10_G16_01.h5')
|
||||
model.compile(optimizer=Adam(0.001, amsgrad=True, decay=5e-5), loss='sparse_categorical_crossentropy')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue