aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJamie Bullock <jamie@postlude.co.uk>2007-12-24 13:21:13 +0000
committerJamie Bullock <jamie@postlude.co.uk>2007-12-24 13:21:13 +0000
commit6abcb447777c3ab48bdbe720fc3d84d3e8841317 (patch)
tree01e0930c51bc1c5cf43aeed186f196e095378fe1 /examples
parent672302aadaba97f3e5df256e3d358cb2411ab3ed (diff)
downloadLibXtract-6abcb447777c3ab48bdbe720fc3d84d3e8841317.tar.gz
LibXtract-6abcb447777c3ab48bdbe720fc3d84d3e8841317.tar.bz2
LibXtract-6abcb447777c3ab48bdbe720fc3d84d3e8841317.zip
- Fixes to descriptors.c where no break statement was given for certain cases is switch conditionals
- Added LPC and LPCC extraction functions. LPC implements Durbin method as described in Rabiner and Juang and implemented in Dr. Dobbs 1994 edition by Jutta Degener
Diffstat (limited to 'examples')
-rw-r--r--examples/puredata/lpcc-test.pd57
-rw-r--r--examples/puredata/xtract~.c10
2 files changed, 63 insertions, 4 deletions
diff --git a/examples/puredata/lpcc-test.pd b/examples/puredata/lpcc-test.pd
new file mode 100644
index 0000000..607e846
--- /dev/null
+++ b/examples/puredata/lpcc-test.pd
@@ -0,0 +1,57 @@
+#N canvas 356 233 722 300 10;
+#X obj 160 170 xtract~ autocorrelation;
+#N canvas 0 0 450 300 graph1 0;
+#X array lpcc 16 float 5;
+#A 0 0 0 -0.827113 -0.827113 -0.827113 -0.485055 0.314974 0.657032
+0.810476 0.396513 0.0440753 -0.630112 -0.9456 -0.887411 -1.12995 0.596854
+;
+#X coords 0 16 15 -16 200 140 1;
+#X restore 458 97 graph;
+#X obj 149 34 noise~;
+#N canvas 9 103 450 300 lpc 0;
+#X obj 323 25 block~ 32;
+#X obj 140 52 inlet~;
+#X obj 140 113 xtract~ lpc;
+#N canvas 237 125 450 300 lpcc 0;
+#X obj 26 130 xtract~ lpcc;
+#N canvas 0 0 450 300 graph1 0;
+#X array lpc 16 float 5;
+#A 0 -1.03207 -1.03207 -1.03207 -21.8757 -21.8757 -21.8757 -21.8757
+-0.391539 -0.391539 -0.391539 -0.391539 0.448536 0.448536 0.448536
+0.448536 0.516603;
+#X coords 0 16 15 -16 200 140 1;
+#X restore 219 37 graph;
+#X obj 23 12 block~ 16;
+#X obj 26 51 tabreceive~ lpc;
+#X msg 95 107 list 16;
+#X obj 24 196 tabsend~ lpcc;
+#X obj 95 85 loadbang;
+#X connect 0 0 5 0;
+#X connect 3 0 0 0;
+#X connect 4 0 0 1;
+#X connect 6 0 4 0;
+#X restore 298 172 pd lpcc;
+#X obj 137 220 tabsend~ lpc;
+#X obj 139 152 a_blockswap~ 32;
+#X connect 1 0 2 0;
+#X connect 2 0 5 0;
+#X connect 5 0 4 0;
+#X restore 160 218 pd lpc;
+#X obj 31 52 a_hann 16;
+#X obj 31 25 loadbang;
+#X obj 98 23 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1
+-1;
+#X obj 156 139 *~;
+#X obj 27 -41 block~ 16 4;
+#X obj 265 81 *~ 0.4;
+#X obj 148 87 *~ 0.1;
+#X obj 266 46 osc~ 1000;
+#X connect 0 0 3 0;
+#X connect 2 0 10 0;
+#X connect 4 0 7 0;
+#X connect 5 0 4 0;
+#X connect 6 0 4 0;
+#X connect 7 0 0 0;
+#X connect 9 0 7 1;
+#X connect 10 0 7 1;
+#X connect 11 0 9 0;
diff --git a/examples/puredata/xtract~.c b/examples/puredata/xtract~.c
index e58aea0..f82aab6 100644
--- a/examples/puredata/xtract~.c
+++ b/examples/puredata/xtract~.c
@@ -93,7 +93,7 @@ static t_int *xtract_perform_vector(t_int *w) {
tmp_in = copybytes(in, N * sizeof(t_float));
tmp_out = getbytes(N * sizeof(t_float));
- if(x->feature == XTRACT_PEAK_SPECTRUM)
+ if(x->feature == XTRACT_PEAK_SPECTRUM || x->feature == XTRACT_LPC)
N >>= 1;
return_code = xtract[x->feature](tmp_in, N, x->argv, tmp_out);
@@ -239,7 +239,9 @@ static void *xtract_new(t_symbol *me, t_int argc, t_atom *argv) {
x->feature == XTRACT_BARK_COEFFICIENTS ||
x->feature == XTRACT_SPECTRUM ||
x->feature == XTRACT_PEAK_SPECTRUM ||
- x->feature == XTRACT_HARMONIC_SPECTRUM)
+ x->feature == XTRACT_HARMONIC_SPECTRUM ||
+ x->feature == XTRACT_LPC ||
+ x->feature == XTRACT_LPCC)
x->feature_type = XTRACT_VECTOR;
else if (x->feature == XTRACT_FLUX || x->feature == XTRACT_ATTACK_TIME ||
@@ -273,8 +275,8 @@ t_int argc, t_atom *argv) {
x->argv = getbytes(argc * sizeof(float));
- while(argc--)
- ((t_float *)x->argv)[argc] = atom_getfloat(&argv[argc]);
+ while(argc--)
+ ((t_float *)x->argv)[argc] = atom_getfloat(&argv[argc]);
/* }*/
}