shithub: opus

Download patch

ref: 8caaa5e91742059b95be5571a62fd716cb784458
parent: cf926d11e0c288e1d731fdfb923058b1f5a72b87
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Tue Nov 6 22:26:10 EST 2018

Output directly to 16-bit (raw) PCM

--- a/dnn/test_lpcnet.py
+++ b/dnn/test_lpcnet.py
@@ -21,6 +21,7 @@
 #model.summary()
 
 feature_file = sys.argv[1]
+out_file = sys.argv[2]
 frame_size = 160
 nb_features = 55
 nb_used_features = model.nb_used_features
@@ -50,6 +51,8 @@
 mem = 0
 coef = 0.85
 
+fout = open(out_file, 'wb')
+
 skip = order + 1
 for c in range(0, nb_frames):
     cfeat = enc.predict([features[c:c+1, :, :nb_used_features], periods[c:c+1, :, :]])
@@ -72,7 +75,8 @@
             pcm[f*frame_size + i] = pred + ulaw2lin(iexc[0, 0, 0])
             fexc[0, 0, 0] = lin2ulaw(pcm[f*frame_size + i])
             mem = coef*mem + pcm[f*frame_size + i]
-            print(mem)
+            #print(mem)
+            np.array([mem], dtype='int16').tofile(fout)
         skip = 0
 
 
--