aboutsummaryrefslogtreecommitdiff
path: root/misc/tprede.c
diff options
context:
space:
mode:
authorAuthor Name <[email protected]>2023-07-07 12:20:59 +0930
committerDavid Rowe <[email protected]>2023-07-07 12:29:06 +0930
commitac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch)
treea2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /misc/tprede.c
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'misc/tprede.c')
-rw-r--r--misc/tprede.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/misc/tprede.c b/misc/tprede.c
new file mode 100644
index 0000000..4d3d09c
--- /dev/null
+++ b/misc/tprede.c
@@ -0,0 +1,53 @@
+/*
+ tpre_de.c
+ David Rowe
+ Sep 24 2012
+
+ Unit test to generate the combined impulse response of pre & de-emphasis filters.
+
+ pl("../unittest/out48.raw",1,3000)
+ pl("../unittest/out8.raw",1,3000)
+
+ Listening to it also shows up anything nasty:
+
+ $ play -s -2 -r 48000 out48.raw
+ $ play -s -2 -r 8000 out8.raw
+
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "lpc.h"
+
+#define N 10
+#define F 10
+
+int main() {
+ FILE *fprede;
+ float Sn[N], Sn_pre[N], Sn_de[N];
+ float pre_mem = 0.0, de_mem = 0.0;
+ int i, f;
+
+ fprede = fopen("prede.txt", "wt");
+ assert(fprede != NULL);
+
+ for(i=0; i<N; i++)
+ Sn[i] = 0.0;
+
+ Sn[0]= 1.0;
+
+ for(f=0; f<F; f++) {
+ pre_emp(Sn_pre, Sn, &pre_mem, N);
+ de_emp(Sn_de, Sn_pre, &de_mem, N);
+ for(i=0; i<N; i++) {
+ fprintf(fprede, "%f\n", Sn_de[i]);
+ }
+ Sn[0] = 0.0;
+ }
+
+ fclose(fprede);
+
+ return 0;
+}