shithub: opus

Download patch

ref: 3b8d64d7464ff8b9a1a4a7258e1c9d2adf63e41f
parent: e4b4613d05065f128e33f7b1704134ed85f6ea23
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Wed Sep 15 12:02:54 EDT 2021

single-frame features for -features option

--- a/dnn/lpcnet_demo.c
+++ b/dnn/lpcnet_demo.c
@@ -99,13 +99,13 @@
         LPCNetEncState *net;
         net = lpcnet_encoder_create();
         while (1) {
-            float features[4][NB_TOTAL_FEATURES];
-            short pcm[LPCNET_PACKET_SAMPLES];
+            float features[NB_TOTAL_FEATURES];
+            short pcm[LPCNET_FRAME_SIZE];
             size_t ret;
-            ret = fread(pcm, sizeof(pcm[0]), LPCNET_PACKET_SAMPLES, fin);
-            if (feof(fin) || ret != LPCNET_PACKET_SAMPLES) break;
-            lpcnet_compute_features(net, pcm, features);
-            fwrite(features, sizeof(float), 4*NB_TOTAL_FEATURES, fout);
+            ret = fread(pcm, sizeof(pcm[0]), LPCNET_FRAME_SIZE, fin);
+            if (feof(fin) || ret != LPCNET_FRAME_SIZE) break;
+            lpcnet_compute_single_frame_features(net, pcm, features);
+            fwrite(features, sizeof(float), NB_TOTAL_FEATURES, fout);
         }
         lpcnet_encoder_destroy(net);
     } else if (mode == MODE_SYNTHESIS) {
--