aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flib/README43
-rw-r--r--flib/doc/help-flib.pd370
-rw-r--r--flib/doc/help-mfcc.pd174
-rw-r--r--flib/doc/help-wdv.pd171
-rw-r--r--flib/gpl.txt340
-rw-r--r--flib/makefile161
-rw-r--r--flib/src/bmax~.c103
-rw-r--r--flib/src/clean~.c87
-rw-r--r--flib/src/flib.c61
-rw-r--r--flib/src/flib.h40
-rw-r--r--flib/src/ha~.c85
-rw-r--r--flib/src/hca~.c108
-rw-r--r--flib/src/irreg~.c70
-rw-r--r--flib/src/melf~.c218
-rw-r--r--flib/src/mspec~.c89
-rw-r--r--flib/src/peak~.c129
-rw-r--r--flib/src/pp~.c70
-rw-r--r--flib/src/pspec~.c77
-rw-r--r--flib/src/sc~.c77
-rw-r--r--flib/src/sfm~.c75
-rw-r--r--flib/src/ss~.c71
-rw-r--r--flib/src/trist~.c92
-rw-r--r--flib/src/wdv~.c234
23 files changed, 2945 insertions, 0 deletions
diff --git a/flib/README b/flib/README
new file mode 100644
index 0000000..83f8c1f
--- /dev/null
+++ b/flib/README
@@ -0,0 +1,43 @@
+flib - PD library for feature extraction
+----------------------------------------
+
+Installation
+------------
+
+To install this library, cd to src/ check that the install prefix in the Makefile is correct for your installation of PD, then type:
+
+ make
+ make install (as root)
+
+
+Usage
+-----
+
+To use this library type:
+
+ pd -lib flib
+
+and create an instance of one of the object classes.
+
+
+Notes
+-----
+
+This library was made for my own personal use in order to facilitate feature extraction in PD. It comes without any warranty.
+
+Comments, bug reports and suggestions are welcome via email at the following address:
+
+ flib@postlude.co.uk
+
+If you intend to modify or add to the library, please also let me know.
+
+Enjoy!
+
+Jamie Bullock, 2005.
+
+LICENSE INFORMATION
+-------------------
+
+flib is licensed under the GPL, see gpl.txt for details.
+
+
diff --git a/flib/doc/help-flib.pd b/flib/doc/help-flib.pd
new file mode 100644
index 0000000..85cd3fb
--- /dev/null
+++ b/flib/doc/help-flib.pd
@@ -0,0 +1,370 @@
+#N canvas 112 125 1263 654 10;
+#N canvas 0 0 450 300 graph1 0;
+#X array hanning-256 256 float 1;
+#A 0 6.25849e-07 0.000178367 0.000671506 0.00147969 0.00260246 0.00403905
+0.00578856 0.00784993 0.0102219 0.0129028 0.0158911 0.0191849 0.022782
+0.0266803 0.0308772 0.0353702 0.0401563 0.0452325 0.0505957 0.0562425
+0.0621693 0.0683723 0.0715762 0.0781863 0.0850625 0.0922004 0.0995958
+0.107244 0.11514 0.123278 0.131655 0.140263 0.149099 0.158156 0.167429
+0.176912 0.186598 0.196483 0.206559 0.21682 0.227259 0.237871 0.248648
+0.254097 0.265109 0.27627 0.287572 0.299007 0.31057 0.322252 0.334047
+0.345946 0.357942 0.370028 0.382196 0.394438 0.406747 0.419115 0.431534
+0.443996 0.456493 0.469018 0.481562 0.494118 0.500398 0.512957 0.525507
+0.538041 0.550552 0.56303 0.575469 0.58786 0.600195 0.612467 0.624669
+0.636792 0.648828 0.66077 0.672611 0.684344 0.695959 0.707452 0.718813
+0.730036 0.741114 0.75204 0.757444 0.768129 0.778644 0.788984 0.799141
+0.80911 0.818884 0.828456 0.837821 0.846973 0.855907 0.864615 0.873094
+0.881337 0.889339 0.897096 0.904602 0.911853 0.918844 0.925571 0.932029
+0.935156 0.941204 0.946974 0.952461 0.957663 0.962576 0.967197 0.971524
+0.975553 0.979282 0.982708 0.98583 0.988646 0.991153 0.99335 0.995236
+0.996809 0.998069 0.999014 0.999645 0.999961 1 0.999842 0.999369 0.998581
+0.997478 0.996061 0.994332 0.99229 0.989938 0.987276 0.984307 0.981033
+0.977455 0.973576 0.969398 0.964923 0.960156 0.955098 0.949753 0.944124
+0.938215 0.932029 0.928834 0.922241 0.915381 0.90826 0.900881 0.893248
+0.885368 0.877245 0.868883 0.860289 0.851468 0.842424 0.833165 0.823696
+0.814022 0.80415 0.794086 0.783836 0.773408 0.762807 0.75204 0.746596
+0.735594 0.724442 0.713149 0.701721 0.690166 0.678492 0.666704 0.654811
+0.642821 0.630741 0.618578 0.60634 0.594035 0.581671 0.569255 0.556795
+0.5443 0.531777 0.519233 0.506678 0.500398 0.487839 0.475288 0.462753
+0.450241 0.43776 0.425319 0.412924 0.400585 0.388309 0.376102 0.363975
+0.351932 0.339984 0.328136 0.316397 0.304773 0.293273 0.281903 0.270671
+0.259584 0.248648 0.243239 0.232544 0.222017 0.211666 0.201497 0.191516
+0.18173 0.172145 0.162766 0.1536 0.144653 0.13593 0.127437 0.119179
+0.111161 0.103389 0.0958663 0.088599 0.0815913 0.0748477 0.0683723
+0.0652365 0.0591711 0.0533839 0.0478785 0.0426584 0.0377267 0.0330869
+0.0287416 0.0246937 0.0209457 0.0175 0.0143586 0.0115238 0.00899717
+0.00678036 0.00487477 0.00328156 0.00200179 0.00103623 0.000385523
+5.00679e-05;
+#X coords 0 1 255 0 100 70 1;
+#X restore 957 225 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array sig 256 float 1;
+#A 0 0.0882028 0.249847 0.158233 -0.0711078 -0.143266 -0.00192432 0.105054
+-0.0185066 -0.2325 -0.245457 -0.0385345 0.0474055 -0.269209 -0.782589
+-0.932042 -0.408476 0.452761 0.974147 0.818818 0.294863 -0.035839 0.035261
+0.228814 0.204498 -0.0190405 -0.149703 -0.0458274 0.0974178 0.0315273
+-0.188763 -0.269473 -0.0949638 0.05908 -0.155299 -0.667065 -0.955875
+-0.592696 0.24616 0.906458 0.91268 0.425885 0.00681637 -0.00994283
+0.192372 0.237048 0.0396113 -0.139851 -0.0870222 0.0752399 0.0707226
+-0.135497 -0.275635 -0.15216 0.0459291 -0.0621048 -0.537475 -0.93656
+-0.745236 0.0276915 0.795313 0.974258 0.562364 0.0769531 -0.0407381
+0.144579 0.252835 0.0996539 -0.113842 -0.120637 0.0414755 0.0958167
+-0.077834 -0.26347 -0.203625 0.012337 0.00577845 -0.403719 -0.87833
+-0.859034 -0.19115 0.644975 0.996916 0.694878 0.17243 -0.0513066 0.0908833
+0.250435 0.155676 -0.0734155 -0.142549 0.000213731 0.105022 -0.0211717
+-0.234324 -0.24385 -0.0359013 0.0461391 -0.275233 -0.787735 -0.929719
+-0.398758 0.462413 0.976315 0.813515 0.288718 -0.0372206 0.0377388
+0.230234 0.202513 -0.0217937 -0.149761 -0.0436908 0.0981517 0.0292894
+-0.191174 -0.268698 -0.0921166 0.059115 -0.16046 -0.673152 -0.955736
+-0.584314 0.256684 0.910823 0.908758 0.419243 0.00407006 -0.00800555
+0.194467 0.235821 0.0366517 -0.14072 -0.0851367 0.0766304 0.0691047
+-0.138262 -0.275764 -0.149433 0.0470958 -0.0661218 -0.544023 -0.938463
+-0.738596 0.0385342 0.801737 0.972094 0.555668 0.0728866 -0.039654
+0.147115 0.252479 0.0967525 -0.115478 -0.119228 0.0433478 0.0949464
+-0.0806892 -0.264483 -0.201318 0.0143823 0.00307645 -0.410245 -0.88201
+-0.854423 -0.180564 0.653184 0.996788 0.688608 0.167205 -0.0513339
+0.0935649 0.250979 0.153098 -0.0756955 -0.141797 0.00234526 0.104951
+-0.0238521 -0.236114 -0.242205 -0.0332875 0.0448059 -0.281291 -0.792823
+-0.927288 -0.388985 0.472009 0.978374 0.808155 0.282608 -0.0385361
+0.0402345 0.231616 0.200496 -0.0245299 -0.14978 -0.0415484 0.0988497
+0.0270254 -0.193563 -0.26788 -0.089272 0.059089 -0.165672 -0.679204
+-0.955491 -0.575855 0.267178 0.915083 0.904759 0.412616 0.00139067
+-0.00603411 0.196535 0.234553 0.0336964 -0.14155 -0.0832336 0.0779919
+0.0674526 -0.141016 -0.275849 -0.146692 0.0482119 -0.0702008 -0.550559
+-0.940271 -0.731862 0.049375 0.808066 0.969837 0.548964 0.068882 -0.0385215
+0.149636 0.252079 0.0938421 -0.117078 -0.117791 0.0452009 0.0940372
+-0.0835463 -0.265454 -0.198984 0.0163911 0.000306892 -0.416782 -0.885611
+-0.849707 -0.169951 0.661313 0.996555 0.682306 0.162031 -0.0513018
+0.096247;
+#X coords 0 1 255 -1 100 70 1;
+#X restore 958 135 graph;
+#N canvas 0 0 450 300 graph2 0;
+#X array mspec 256 float 1;
+#A 0 0 6.06409e-05 3.43323e-06 5.41534e-06 5.9304e-06 1.35261e-05 1.91015e-05
+3.50029e-05 6.03186e-05 0.000146125 0.00057431 0.0351573 0.075683 0.0406062
+0.00065639 0.000160416 6.65241e-05 3.56217e-05 3.87878e-05 6.21028e-05
+0.000116698 0.000275588 0.00102868 0.0323063 0.0751352 0.0432778 0.00143625
+0.000328244 0.00013372 7.94839e-05 6.48149e-05 8.48054e-05 0.000164273
+0.00038994 0.00138636 0.0295678 0.0745401 0.0461005 0.00234684 0.000520533
+0.000201176 0.0001109 8.92229e-05 0.00011521 0.000203819 0.00047509
+0.00165658 0.0269778 0.07371 0.0488367 0.00337824 0.000718522 0.0002678
+0.000123016 6.97781e-05 4.39599e-05 2.89888e-05 1.81315e-05 8.02321e-06
+4.2932e-05 3.19731e-05 7.13398e-05 6.27937e-06 6.55321e-06 3.47072e-06
+4.68761e-06 9.70148e-07 4.20768e-06 2.22297e-06 4.57813e-06 2.72943e-06
+2.4934e-05 1.24696e-05 3.12306e-05 4.93845e-06 5.23374e-06 2.5901e-06
+6.4558e-06 1.10631e-06 4.20669e-06 1.25597e-06 4.42744e-06 2.5858e-06
+1.73727e-05 8.23469e-06 1.9841e-05 3.63394e-06 5.77684e-06 2.80965e-06
+6.96524e-06 1.5389e-06 3.95983e-06 1.13787e-06 4.46327e-06 2.14736e-06
+1.35468e-05 5.89897e-06 1.48537e-05 3.01569e-06 6.70124e-06 3.04046e-06
+7.49277e-06 1.37064e-06 3.93801e-06 1.2014e-06 4.31766e-06 1.77567e-06
+1.1294e-05 4.76291e-06 1.20783e-05 2.69957e-06 7.61872e-06 3.13953e-06
+8.04401e-06 1.33446e-06 4.18924e-06 1.18116e-06 4.08866e-06 1.75009e-06
+9.86143e-06 4.25386e-06 9.97615e-06 2.46699e-06 8.52684e-06 3.60427e-06
+8.81445e-06 1.6476e-06 4.17573e-06 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0;
+#X coords 0 1 255 0 100 70 1;
+#X restore 957 310 graph;
+#N canvas 0 0 450 300 graph3 0;
+#X array pspec 256 float 1;
+#A 0 1.5708 0.0979978 0.982296 0.340326 1.28336 -1.55966 1.22616 1.13607
+1.19897 1.23859 1.2239 1.21935 1.21165 1.20376 1.20873 1.27825 1.38541
+-1.50321 -0.975374 -0.649724 -0.611925 -0.577136 -0.550624 -0.552268
+-0.562026 -0.572104 -0.573082 -0.540216 -0.430997 -0.229354 0.173536
+0.512715 0.67185 0.719956 0.738232 0.736648 0.727906 0.717974 0.714571
+0.726237 0.820272 1.08897 1.42542 -1.40975 -1.19765 -1.12402 -1.11587
+-1.11787 -1.12446 -1.13182 -1.13795 -1.1415 -1.15313 -1.16281 -1.12979
+-1.06402 -1.16247 -1.42437 -1.39253 -1.06354 -0.901212 -1.03636 -0.811282
+-1.21056 1.14826 -0.779044 -0.529684 0.0668543 -1.39698 0.336132 -0.643029
+-1.22934 -0.703283 -1.13782 -0.977102 -1.27112 0.618241 -0.962707 -1.50805
+0.225479 1.54863 0.182532 -0.780368 -1.38903 -0.664227 -1.25816 -1.07531
+-1.29479 0.609087 -1.03118 1.37528 0.16476 -1.54755 0.12922 -0.911786
+-1.53147 -0.654362 -1.35918 -1.1881 -1.34017 0.566493 -1.11466 1.15897
+0.169507 -1.54898 0.0449221 -0.926983 1.49116 -0.588533 -1.47244 -1.35217
+-1.42878 0.583302 -1.2002 1.24215 0.107405 1.53777 0.0178888 -0.964926
+1.38525 -0.597952 1.56504 -1.51144 -1.50155 0.636032 -1.28655 1.15887
+0.0076498 1.5708 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+;
+#X coords 0 3.142 255 -3.142 100 70 1;
+#X restore 957 393 graph;
+#X obj 451 79 tabreceive~ hanning-256;
+#X obj 417 105 *~;
+#X obj 447 108 tabsend~ sig;
+#X obj 414 174 mspec~;
+#X obj 417 129 rfft~;
+#X obj 413 223 pspec~;
+#X obj 310 172 tabsend~ mspec;
+#X obj 307 225 tabsend~ pspec;
+#X obj 955 10 block~ 256 1 1;
+#N canvas 0 0 450 300 graph5 0;
+#X array peak 256 float 1;
+#A 0 0 0 0 0 0 0 0 0 0 0 0 0 78.5318 0 0 0 0 0 0 0 0 0 0 0 79.4878
+0 0 0 0 0 0 0 0 0 0 0 80.4952 0 0 0 0 0 0 0 0 0 0 0 81.4833 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+#X coords 0 100 255 0 100 70 1;
+#X restore 959 486 graph;
+#X obj 305 263 tabsend~ peak;
+#X obj 532 55 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 300 1;
+#X obj 419 81 *~;
+#X obj 514 33 expr (1 - $f1);
+#X obj 498 55 *~;
+#X obj 214 343 sc~;
+#X obj 247 344 ss~;
+#X obj 281 344 irreg~;
+#X obj 402 345 trist~ y;
+#X obj 535 344 sfm~;
+#X floatatom 214 384 10 0 0 0 - - -;
+#X floatatom 247 406 15 0 0 0 - - -;
+#X floatatom 282 430 15 0 0 0 - - -;
+#X floatatom 402 475 10 0 0 0 - - -;
+#X floatatom 535 511 10 0 0 0 - - -;
+#N canvas 0 0 450 300 graph6 0;
+#X array synth 515 float 1;
+#A 0 -0.0758575 0 0.0758575 0.151259 0.22575 0.298886 0.370232 0.439366
+0.505884 0.569402 0.629561 0.686025 0.73849 0.78668 0.830352 0.869301
+0.903353 0.932375 0.956271 0.974981 0.988487 0.996808 1 0.998157 0.991408
+0.97992 0.963887 0.94354 0.919135 0.890954 0.859306 0.824517 0.786934
+0.746916 0.704835 0.661072 0.616012 0.570041 0.523545 0.476904 0.430491
+0.384667 0.339778 0.296157 0.254114 0.213937 0.175894 0.140224 0.107139
+0.0768217 0.0494266 0.0250762 0.00386161 -0.0141573 -0.0289523 -0.0405264
+-0.0489129 -0.054175 -0.0564043 -0.0557193 -0.0522641 -0.0462062 -0.0377346
+-0.0270574 -0.0143997 -8.20971e-07 0.0158883 0.0330077 0.0510911 0.069869
+0.089071 0.108429 0.127679 0.146565 0.164841 0.182272 0.198639 0.213738
+0.227383 0.23941 0.249673 0.258052 0.264448 0.268786 0.271017 0.271116
+0.269082 0.264938 0.258732 0.250534 0.240436 0.22855 0.215007 0.199957
+0.183562 0.166002 0.147466 0.128152 0.108266 0.0880183 0.0676219 0.0472895
+0.0272315 0.00765355 -0.0112454 -0.0292755 -0.0462582 -0.0620275 -0.0764325
+-0.0893385 -0.100628 -0.110204 -0.117987 -0.123921 -0.127968 -0.130114
+-0.130365 -0.128751 -0.12532 -0.120142 -0.113307 -0.104922 -0.0951123
+-0.0840199 -0.0718 -0.0586207 -0.0446606 -0.0301073 -0.0151549 -1.64195e-06
+0.0151516 0.0301041 0.0446575 0.0586177 0.0717973 0.0840174 0.09511
+0.10492 0.113305 0.120141 0.125319 0.128751 0.130365 0.130114 0.127968
+0.123922 0.117989 0.110206 0.100631 0.0893411 0.0764355 0.0620308 0.0462617
+0.0292793 0.0112494 -0.00764938 -0.0272272 -0.0472851 -0.0676175 -0.0880139
+-0.108262 -0.128148 -0.147462 -0.165998 -0.183559 -0.199953 -0.215004
+-0.228547 -0.240434 -0.250532 -0.258731 -0.264937 -0.269081 -0.271116
+-0.271018 -0.268787 -0.264449 -0.258054 -0.249675 -0.239412 -0.227386
+-0.213741 -0.198643 -0.182276 -0.164845 -0.146569 -0.127683 -0.108433
+-0.0890752 -0.0698731 -0.0510951 -0.0330115 -0.0158919 -2.46294e-06
+0.0143968 0.0270549 0.0377325 0.0462046 0.0522631 0.0557189 0.0564045
+0.0541758 0.0489144 0.0405285 0.0289552 0.0141609 -0.00385737 -0.0250713
+-0.049421 -0.0768154 -0.107132 -0.140217 -0.175886 -0.213929 -0.254105
+-0.296148 -0.339769 -0.384657 -0.430481 -0.476894 -0.523535 -0.570031
+-0.616002 -0.661063 -0.704826 -0.746907 -0.786925 -0.82451 -0.859299
+-0.890948 -0.919129 -0.943535 -0.963883 -0.979917 -0.991406 -0.998156
+-1 -0.996809 -0.98849 -0.974985 -0.956275 -0.932381 -0.90336 -0.869309
+-0.830361 -0.78669 -0.738501 -0.686037 -0.629574 -0.569416 -0.505898
+-0.439381 -0.370247 -0.298902 -0.225766 -0.151275 -0.0758739 -1.64195e-05
+0.0758412 0.151242 0.225734 0.298871 0.370217 0.439351 0.50587 0.569389
+0.629548 0.686014 0.738479 0.78667 0.830343 0.869293 0.903346 0.93237
+0.956266 0.974978 0.988485 0.996807 1 0.998158 0.99141 0.979922 0.963891
+0.943545 0.91914 0.890961 0.859313 0.824525 0.786942 0.746925 0.704845
+0.661082 0.616022 0.570051 0.523555 0.476914 0.430501 0.384676 0.339788
+0.296166 0.254122 0.213946 0.175902 0.140231 0.107145 0.0768279 0.0494322
+0.0250811 0.00386586 -0.0141538 -0.0289495 -0.0405242 -0.0489114 -0.0541742
+-0.0564041 -0.0557198 -0.0522652 -0.0462078 -0.0377366 -0.0270599 -0.0144026
+-4.10481e-06 0.0158847 0.0330038 0.0510871 0.0698649 0.0890669 0.108425
+0.127675 0.146561 0.164837 0.182269 0.198636 0.213735 0.22738 0.239407
+0.249671 0.25805 0.264447 0.268785 0.271017 0.271116 0.269082 0.264939
+0.258734 0.250536 0.240439 0.228553 0.21501 0.19996 0.183566 0.166006
+0.14747 0.128156 0.10827 0.0880227 0.0676263 0.0472939 0.0272358 0.00765772
+-0.0112414 -0.0292718 -0.0462546 -0.0620243 -0.0764296 -0.0893359 -0.100626
+-0.110202 -0.117986 -0.12392 -0.127967 -0.130113 -0.130366 -0.128752
+-0.125321 -0.120143 -0.113308 -0.104924 -0.0951146 -0.0840225 -0.0718028
+-0.0586236 -0.0446637 -0.0301105 -0.0151581 -4.92584e-06 0.0151483
+0.030101 0.0446545 0.0586148 0.0717945 0.0840149 0.0951078 0.104918
+0.113303 0.12014 0.125318 0.12875 0.130365 0.130114 0.127969 0.123923
+0.11799 0.110208 0.100633 0.0893437 0.0764384 0.0620341 0.0462653 0.0292831
+0.0112534 -0.00764522 -0.0272229 -0.0472807 -0.0676131 -0.0880095 -0.108257
+-0.128143 -0.147458 -0.165995 -0.183555 -0.19995 -0.215001 -0.228545
+-0.240431 -0.25053 -0.258729 -0.264936 -0.26908 -0.271116 -0.271018
+-0.268788 -0.26445 -0.258055 -0.249677 -0.239414 -0.227389 -0.213744
+-0.198646 -0.18228 -0.164849 -0.146573 -0.127687 -0.108437 -0.0890794
+-0.0698772 -0.0510991 -0.0330153 -0.0158954 -5.74692e-06 0.0143938
+0.0270523 0.0377304 0.0462031 0.0522621 0.0557184 0.0564046 0.0541766
+0.0489159 0.0405307 0.028958 0.0141644 -0.00385313 -0.0250663 -0.0494154
+-0.0768092 -0.107125 -0.140209 -0.175878 -0.213921 -0.254096 -0.296138
+-0.339759 -0.384647 -0.430471 -0.476884 -0.523525 -0.570021 -0.615992
+-0.661053 -0.704817 -0.746898 -0.786917 -0.824502 -0.859292 -0.890941
+-0.919123 -0.94353 -0.96388 -0.979914 -0.991404 -0.998155 -1 -0.99681
+-0.988492 -0.974988 -0.95628 -0.932387 -0.903367 -0.869317 -0.83037
+-0.786699 -0.738512 -0.686049 -0.629586 -0.569429 -0.505912 -0.439395
+-0.370262 -0.298918 -0.225782 -0.151291 -0.0758903 -3.28389e-05 0.0758248
+;
+#X coords 0 1 514 -1 100 70 1;
+#X restore 957 44 graph;
+#X obj 482 13 tabosc4~ synth;
+#X text 667 56 Fade between cosine and synth;
+#X text 661 -5 flib - feature extraction library;
+#X text 661 11 *********************************;
+#X text 460 169 Get magnitude spectrum from fft. Argument of 2 gives
+power spectrum.;
+#X text 458 224 Get phase spectrum from fft.;
+#X text 467 253 Get spectral peaks from magnitudes and estimate frequency.
+Argumnent or right inlet sets threshold as percentage of the maximum
+peak detected in each frame;
+#N canvas 0 0 450 300 hidden 0;
+#X msg 89 176 \; pd dsp 1;
+#X obj 30 133 loadbang;
+#X obj 30 151 t b b;
+#X msg 89 123 \; synth sinesum 0.8 0 0.4 0 0.4 0 0.4 0 0.4 \; synth
+normalize;
+#X connect 1 0 2 0;
+#X connect 2 0 0 0;
+#X connect 2 1 3 0;
+#X restore 224 -3 pd hidden;
+#X floatatom 334 455 10 0 0 0 - - -;
+#X obj 334 344 trist~ x;
+#X floatatom 468 493 10 0 0 0 - - -;
+#X obj 468 346 trist~ z;
+#X text 225 530 Spectral Centroid \, Spectral Smoothness \, Irregularity
+\, Tristimulus x \, y and z \, Spectral Flatnes Measure.;
+#X obj 577 344 print~ freq;
+#X obj 577 318 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 413 14 sig~ 2000;
+#X obj 413 31 /~ 2;
+#X obj 418 57 osc~;
+#X obj 416 -6 hsl 128 15 80 8000 0 0 empty empty Fundamental -2 -6
+0 8 -262144 -1 -1 3200 1;
+#X floatatom 363 16 5 0 0 0 - - -;
+#X obj 404 264 peak~ 40;
+#X text 596 318 Bang to print frequency of partials;
+#X obj 257 173 s~ m;
+#X obj 575 408 r~ m;
+#X floatatom 575 450 5 0 0 0 - - -;
+#X obj 672 449 / 128;
+#X floatatom 672 470 8 0 0 0 - - -;
+#X obj 672 428 ++~;
+#X text 733 470 arithmetic mean;
+#X obj 575 429 bmax~ 2;
+#X obj 619 450 unpack;
+#X floatatom 619 471 5 0 0 0 - - -;
+#X floatatom 656 489 5 0 0 0 - - -;
+#X text 695 490 locations of max value;
+#X text 612 407 bmax gives block max \, arg gives n locations;
+#X text 705 428 ++ returns the sum of block samps;
+#X obj 165 297 fiddle~;
+#X obj 363 129 s~ fidd;
+#X obj 166 275 r~ fidd;
+#X obj 194 318 mtof;
+#X floatatom 158 382 5 0 0 0 - - -;
+#X floatatom 179 404 5 0 0 0 - - -;
+#X floatatom 202 427 5 0 0 0 - - -;
+#X obj 158 344 hca~ 10;
+#X text -17 443 Partials \, harmonics \, even harmonics;
+#X obj 126 344 /;
+#X floatatom 116 380 5 0 0 0 - - -;
+#X text 27 378 Harmonicity;
+#X connect 4 0 5 1;
+#X connect 5 0 8 0;
+#X connect 5 0 67 0;
+#X connect 7 0 10 0;
+#X connect 7 0 20 0;
+#X connect 7 0 21 0;
+#X connect 7 0 50 0;
+#X connect 7 0 52 0;
+#X connect 8 0 7 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 1;
+#X connect 8 1 9 1;
+#X connect 9 0 11 0;
+#X connect 15 0 16 1;
+#X connect 15 0 17 0;
+#X connect 16 0 5 0;
+#X connect 16 0 6 0;
+#X connect 17 0 18 1;
+#X connect 18 0 5 0;
+#X connect 18 0 6 0;
+#X connect 19 0 24 0;
+#X connect 20 0 25 0;
+#X connect 21 0 26 0;
+#X connect 22 0 27 0;
+#X connect 23 0 28 0;
+#X connect 30 0 18 0;
+#X connect 39 0 38 0;
+#X connect 41 0 40 0;
+#X connect 44 0 43 0;
+#X connect 45 0 46 0;
+#X connect 45 0 47 0;
+#X connect 46 0 30 0;
+#X connect 47 0 16 0;
+#X connect 48 0 45 0;
+#X connect 48 0 49 0;
+#X connect 50 0 19 0;
+#X connect 50 0 43 0;
+#X connect 50 0 73 0;
+#X connect 50 1 14 0;
+#X connect 50 1 19 1;
+#X connect 50 1 22 0;
+#X connect 50 1 23 0;
+#X connect 50 1 39 0;
+#X connect 50 1 41 0;
+#X connect 53 0 57 0;
+#X connect 53 0 59 0;
+#X connect 55 0 56 0;
+#X connect 57 0 55 0;
+#X connect 59 0 54 0;
+#X connect 59 1 60 0;
+#X connect 60 0 61 0;
+#X connect 60 1 62 0;
+#X connect 66 2 69 0;
+#X connect 68 0 66 0;
+#X connect 69 0 73 1;
+#X connect 73 0 70 0;
+#X connect 73 0 75 1;
+#X connect 73 1 71 0;
+#X connect 73 1 75 0;
+#X connect 73 2 72 0;
+#X connect 75 0 76 0;
diff --git a/flib/doc/help-mfcc.pd b/flib/doc/help-mfcc.pd
new file mode 100644
index 0000000..ae90b96
--- /dev/null
+++ b/flib/doc/help-mfcc.pd
@@ -0,0 +1,174 @@
+#N canvas 302 72 832 546 10;
+#N canvas 0 0 607 458 mfcc 0;
+#X obj 128 128 rfft~;
+#X obj 122 194 unpack~;
+#X obj 218 -15 block~ 512;
+#X obj 121 262 log~;
+#X obj 179 327 tabsend~ spec;
+#X obj 122 150 mspec~ 2;
+#X obj 122 284 clean~;
+#N canvas 0 0 450 300 graph1 0;
+#X array hann 512 float 1;
+#A 0 8.9407e-08 3.58522e-05 0.000150532 0.000344157 0.000616699 0.000968069
+0.00139824 0.00190714 0.00249469 0.0031608 0.00390536 0.00472826 0.00562936
+0.00660852 0.0076656 0.00880042 0.0100128 0.0113026 0.0126694 0.0141133
+0.0156339 0.017231 0.0189043 0.0206535 0.0224785 0.0243788 0.0263543
+0.0284045 0.0305292 0.0316194 0.0338552 0.0361646 0.0385472 0.0410027
+0.0435306 0.0461307 0.0488024 0.0515454 0.0543591 0.0572433 0.0601973
+0.0632208 0.0663133 0.0694742 0.0727032 0.0759995 0.0793629 0.0827926
+0.0862883 0.0898493 0.093475 0.0971649 0.100918 0.104735 0.108614 0.112555
+0.116557 0.120619 0.122673 0.126825 0.131036 0.135305 0.139632 0.144016
+0.148456 0.152951 0.157502 0.162106 0.166764 0.171474 0.176236 0.18105
+0.185913 0.190827 0.195789 0.200799 0.205856 0.21096 0.21611 0.221304
+0.226543 0.231824 0.237148 0.242513 0.247919 0.253365 0.256103 0.261606
+0.267148 0.272726 0.27834 0.28399 0.289673 0.29539 0.301139 0.306919
+0.312729 0.31857 0.324439 0.330335 0.336259 0.342208 0.348182 0.35418
+0.360202 0.366245 0.372309 0.378394 0.384498 0.39062 0.396759 0.402915
+0.409086 0.415271 0.42147 0.424574 0.43079 0.437018 0.443256 0.449503
+0.455757 0.462019 0.468287 0.47456 0.480836 0.487116 0.493398 0.499681
+0.505963 0.512245 0.518525 0.524802 0.531075 0.537344 0.543606 0.549861
+0.556109 0.562348 0.568577 0.574795 0.581001 0.587194 0.593374 0.596458
+0.602616 0.608757 0.61488 0.620986 0.627073 0.633139 0.639185 0.645208
+0.651209 0.657186 0.663138 0.669063 0.674963 0.680835 0.686678 0.692492
+0.698275 0.704027 0.709747 0.715434 0.721087 0.726704 0.732287 0.737832
+0.743339 0.748809 0.754239 0.759629 0.762308 0.767636 0.772923 0.778165
+0.783364 0.788518 0.793626 0.798689 0.803704 0.808671 0.813589 0.818458
+0.823277 0.828044 0.832759 0.837423 0.842032 0.846588 0.851089 0.855535
+0.859925 0.864257 0.868533 0.872749 0.876908 0.881006 0.885045 0.889022
+0.890988 0.894873 0.898696 0.902456 0.906153 0.909785 0.913353 0.916855
+0.920291 0.923662 0.926965 0.930201 0.933368 0.936468 0.939498 0.942459
+0.945351 0.948172 0.950922 0.953601 0.956208 0.958744 0.961206 0.963596
+0.965913 0.968157 0.970326 0.972421 0.974442 0.975424 0.977332 0.979164
+0.980921 0.982602 0.984207 0.985736 0.987187 0.988562 0.98986 0.99108
+0.992223 0.993288 0.994275 0.995184 0.996015 0.996767 0.997441 0.998037
+0.998554 0.998992 0.999351 0.999632 0.999833 0.999956 1 0.999965 0.999851
+0.999764 0.999531 0.99922 0.99883 0.998361 0.997813 0.997187 0.996482
+0.995699 0.994838 0.993898 0.99288 0.991785 0.990612 0.989362 0.988034
+0.986629 0.985147 0.983589 0.981954 0.980243 0.978457 0.976595 0.974657
+0.972645 0.970558 0.968397 0.966161 0.963853 0.962671 0.960252 0.957761
+0.955197 0.952562 0.949855 0.947077 0.944229 0.94131 0.938322 0.935264
+0.932138 0.928944 0.925681 0.922352 0.918956 0.915493 0.911966 0.908373
+0.904715 0.900994 0.897209 0.893362 0.889452 0.885481 0.88145 0.877357
+0.873206 0.871108 0.866868 0.86257 0.858215 0.853804 0.849336 0.844814
+0.840237 0.835606 0.830922 0.826186 0.821399 0.816561 0.811672 0.806735
+0.801749 0.796715 0.791635 0.786509 0.781337 0.776121 0.770861 0.765559
+0.760214 0.754829 0.749403 0.743938 0.738434 0.732893 0.730108 0.724513
+0.718881 0.713215 0.707515 0.701782 0.696018 0.690223 0.684397 0.678542
+0.67266 0.66675 0.660814 0.654852 0.648866 0.642856 0.636824 0.63077
+0.624696 0.618601 0.612489 0.606358 0.60021 0.594047 0.587869 0.581677
+0.575472 0.569255 0.566143 0.55991 0.553668 0.547417 0.541159 0.534894
+0.528623 0.522349 0.516071 0.50979 0.503507 0.497224 0.490942 0.48466
+0.478382 0.472107 0.465836 0.459571 0.453311 0.44706 0.440817 0.434582
+0.428359 0.422146 0.415946 0.40976 0.403587 0.39743 0.391288 0.388224
+0.382109 0.376013 0.369936 0.36388 0.357845 0.351833 0.345844 0.339879
+0.33394 0.328027 0.322141 0.316283 0.310454 0.304656 0.298887 0.293151
+0.287447 0.281777 0.276141 0.270541 0.264977 0.25945 0.253961 0.248511
+0.243101 0.237731 0.232402 0.229754 0.22449 0.219268 0.214091 0.208959
+0.203874 0.198835 0.193843 0.1889 0.184006 0.179162 0.174369 0.169627
+0.164937 0.1603 0.155716 0.151188 0.146714 0.142296 0.137934 0.133629
+0.129383 0.125195 0.121066 0.116997 0.112988 0.109041 0.105155 0.101332
+0.0994434 0.0957148 0.09205 0.0884494 0.084914 0.0814439 0.0780401
+0.074703 0.0714327 0.0682305 0.0650961 0.0620306 0.0590343 0.0561074
+0.0532508 0.0504645 0.0477495 0.0451058 0.0425338 0.0400342 0.037607
+0.035253 0.0329725 0.0307654 0.0286327 0.0265742 0.0245907 0.022682
+0.021756 0.0199607 0.018241 0.0165975 0.0150304 0.0135397 0.0121259
+0.0107891 0.00952962 0.00834757 0.00724307 0.00621647 0.00526777 0.00439724
+0.00360498 0.00289103 0.00225565 0.00169882 0.0012207 0.000821322 0.000500739
+0.000259072 9.62913e-05 1.24574e-05 0.01236 0.0060784 -0.000203653
+;
+#X coords 0 1 511 -1 200 140 1;
+#X restore 380 -10 graph;
+#X obj 128 107 *~;
+#X obj 168 76 tabreceive~ hann;
+#X obj 121 75 inlet~;
+#X obj 121 172 melf~ 187;
+#X obj 36 235 +~ 1;
+#X obj 36 258 log~;
+#X obj 37 280 clean~;
+#X obj 121 349 outlet~;
+#X connect 0 0 5 0;
+#X connect 0 1 5 1;
+#X connect 1 0 12 0;
+#X connect 1 0 3 0;
+#X connect 3 0 6 0;
+#X connect 5 0 11 0;
+#X connect 6 0 15 0;
+#X connect 6 0 4 0;
+#X connect 8 0 0 0;
+#X connect 9 0 8 1;
+#X connect 10 0 8 0;
+#X connect 11 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 14 0;
+#X restore 140 73 pd mfcc;
+#X obj 45 48 dac~;
+#N canvas 0 0 600 443 fct 0;
+#X obj 243 93 block~ 16;
+#X obj 179 171 fct~;
+#X obj 112 249 print~;
+#X obj 90 208 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 176 134 inlet~;
+#X obj 331 281 outlet~;
+#X connect 1 0 2 0;
+#X connect 1 0 5 0;
+#X connect 3 0 2 0;
+#X connect 4 0 1 0;
+#X restore 545 10 pd fct;
+#X obj 139 99 print~;
+#X obj 113 101 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#N canvas 0 0 450 300 graph5 0;
+#X array spec 40 float 1;
+#A 0 2.86481 2.86481 2.83531 2.83512 2.8309 2.07639 1.13988 1.12299
+-0.353648 -2.92611 -3.5885 -4.36502 -6.15121 -6.98619 -9.91928 -10.5941
+-10.7128 -10.8042 -10.8947 -10.9756 -11.0836 -11.1863 -11.3158 -11.4645
+-11.6485 -11.8594 -12.1393 -12.4984 -12.9995 -13.8127 -23.0259 -23.0259
+-23.0259 -23.0259 -23.0259 -23.0259 -23.0259 -23.0259 -23.0259 -23.0259
+;
+#X coords 0 3 39 -25 200 140 1;
+#X restore 537 -197 graph;
+#X obj 545 -12 tabreceive~ spec;
+#N canvas 0 0 450 300 graph2 0;
+#X array coeffs 16 float 1;
+#A 0 -2.32584 6.22457 -1.81618 0.27007 -0.395653 0.397333 -0.307564
+0.01785 0.238073 0.0359483 -0.193879 -0.118693 0.266058 -0.168167 0.102818
+-0.0593694;
+#X coords 0 5 15 -5 200 140 1;
+#X restore 538 135 graph;
+#X obj 545 29 tabsend~ coeffs;
+#N canvas 0 0 450 300 synth 0;
+#X obj 42 130 osc~;
+#X obj 41 167 outlet~;
+#X obj 41 73 +~;
+#X obj 42 101 *~;
+#X obj 118 47 osc~ 880;
+#X obj 42 49 osc~ 440;
+#X obj 71 100 *~ 44;
+#X obj 71 78 inlet;
+#X connect 0 0 1 0;
+#X connect 2 0 3 0;
+#X connect 3 0 0 0;
+#X connect 4 0 2 1;
+#X connect 5 0 2 0;
+#X connect 6 0 3 1;
+#X connect 7 0 6 0;
+#X restore 139 50 pd synth;
+#X obj 138 -10 hsl 100 15 1 100 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 500 1;
+#X obj 87 48 *~ 0.2;
+#X obj 140 30 line;
+#X msg 138 9 \$1 40;
+#X text 82 -157 Uses melf~ to create a mel spaced filterbank so that
+mel frequency cepstral coefficients can be generated. Requires zexy
+and fct~;
+#X connect 0 0 3 0;
+#X connect 2 0 8 0;
+#X connect 4 0 3 0;
+#X connect 6 0 2 0;
+#X connect 9 0 0 0;
+#X connect 9 0 11 0;
+#X connect 10 0 13 0;
+#X connect 11 0 1 0;
+#X connect 12 0 9 0;
+#X connect 13 0 12 0;
diff --git a/flib/doc/help-wdv.pd b/flib/doc/help-wdv.pd
new file mode 100644
index 0000000..1c3993c
--- /dev/null
+++ b/flib/doc/help-wdv.pd
@@ -0,0 +1,171 @@
+#N canvas 532 536 920 420 10;
+#N canvas 456 256 720 525 sub 1;
+#X obj 62 174 dwt~;
+#N canvas 0 0 450 300 graph1 0;
+#X array array1 1024 float 5;
+#A 0 0.018721 0.311023 -0.360983 0.756994 -0.378297 -0.526546 -0.0112677
+0.454874 -0.181682 -0.0861944 0.126519 -1.29822 0.0487404 0.683317
+-0.250342 0.813103 -0.39848 -0.333765 0.826898 0.171634 -0.661465 0.298564
+-0.173011 0.446284 0.183731 0.286817 -0.406318 1.81085 -0.40292 1.32676
+0.220727 0.162767 -0.0951232 0.822183 -0.198127 0.341843 -0.394375
+-0.396391 -0.069129 0.349025 0.521622 0.647087 -1.42353 -0.434856 0.02042
+0.792919 -0.792579 0.96966 0.100891 -0.535588 0.0424738 0.359418 1.09146
+0.386636 -0.199622 -0.432605 -0.259628 -0.694836 0.824883 -0.318549
+0.69376 -1.29517 0.584741 0.26308 0.0213646 0.528472 1.6737 0.566156
+-0.37582 0.895691 0.93551 -0.244311 0.759903 -1.17841 0.463921 0.12657
+-0.66415 -0.0644595 -0.272315 0.322323 -0.281433 1.19991 0.94555 -0.446146
+0.64127 -0.371179 0.836267 -1.18179 0.0684967 0.00692078 0.368585 0.117297
+0.306065 -1.3919 0.886254 -0.323314 -0.0451965 -0.0857349 -0.391974
+0.16431 0.439609 0.334074 -0.872352 -1.09076 0.765762 -0.0783044 0.288873
+0.12043 -0.0362206 -0.904443 0.185449 0.105466 -0.113464 0.357093 0.0361262
+0.489319 0.769199 -0.990505 0.0596552 -1.56691 0.238419 -0.123536 -0.275214
+0.852765 0.527744 0.020956 0.250268 -1.36204 0.051091 -0.536062 -0.645148
+-0.129321 -0.604336 0.903133 0.632287 0.0440529 -0.699081 -0.568228
+1.05132 -0.718901 -0.783291 -0.742656 0.205712 -0.446534 0.387268 0.420346
+0.314202 -0.0998134 -1.306 -0.486967 0.970544 0.646425 -0.363144 1.39817
+0.018487 -0.377771 0.108799 -0.0722316 0.926782 0.381279 -0.309418
+-0.338135 -0.210822 -0.580361 0.554844 0.587243 -0.550574 0.394503
+0.246231 0.836196 -0.123725 -0.657048 -0.186611 -0.594724 -0.336524
+-0.0993032 -0.0419311 0.874041 -0.970222 0.520832 0.400059 0.12381
+-0.806067 0.692585 -0.228378 -0.943594 -0.625312 -0.839935 -0.200771
+-0.687087 -1.8342 0.141016 0.196411 -0.00757823 -0.338996 0.545563
+0.245274 -0.62922 -0.0459356 0.194966 -0.65416 -0.380656 -0.986274
+-0.959636 -0.308681 -0.476272 -0.19126 0.381533 -0.0795288 0.202553
+-0.192145 -0.91437 -1.17514 -0.1738 0.354821 -0.194056 0.113419 -0.664444
+0.293389 0.200647 -0.322842 0.160766 0.467309 0.151546 0.505707 -0.0600172
+-0.27967 -1.01717 -0.0955468 0.238118 -1.2288 0.679815 0.390762 -0.73441
+-1.16132 0.107711 0.241123 0.597075 -0.608497 1.23035 -0.0343628 -0.109743
+1.02343 -0.671044 0.0152931 0.604579 -0.29679 -0.779122 0.953262 -0.280009
+0.27459 0.478351 -0.148037 0.455701 -0.293677 0.647245 -0.0438594 0.988923
+0.217156 -0.534191 0.219883 -0.826368 0.525842 0.0834273 -0.099472
+0.259308 -0.148871 1.27937 -0.0371971 -0.390309 0.536767 -1.31848 0.108948
+1.42153 -0.323493 0.985185 -0.106777 -0.556678 -0.135901 -0.828239
+-0.0135345 0.694088 0.443292 -0.272448 0.120518 -0.817907 -0.117164
+-1.13751 0.209747 -0.376382 0.276483 0.72888 0.0978126 1.1617 0.34298
+-0.359824 0.0196686 1.08488 -0.94892 -0.710294 -0.190517 -1.45405 -0.630469
+-1.03057 0.113831 -0.71926 -0.857917 -1.21131 -0.0100975 0.326804 -0.662513
+0.89297 -0.132675 0.742219 -0.700507 -0.317376 0.123447 -0.675682 0.37185
+1.03165 -0.0574379 0.328442 1.14831 0.506416 0.397617 0.186689 1.22262
+0.584438 -0.240097 -0.773334 0.438531 -0.126896 -0.0938377 -0.609765
+0.264794 0.32844 0.346741 0.95227 -1.20484 -0.526149 0.180332 0.2394
+-0.501624 0.618878 -0.365097 -0.651239 0.218194 -0.922057 -0.404873
+-0.133249 -0.451636 -0.610898 0.0533447 0.587771 -0.667365 0.532792
+-0.833828 -0.767018 0.289758 0.150586 0.304825 0.169054 -0.111518 -0.236063
+0.018467 0.126912 -0.277442 -1.00707 -0.0265503 -0.0795085 0.760736
+-0.224962 -0.426113 0.165484 -0.153235 0.58386 -0.052597 -1.00191 0.449395
+-0.352117 -0.0269432 0.793766 0.0373774 0.169224 0.127574 -0.114021
+0.704461 -0.457616 0.294102 -0.715048 -0.330604 0.572997 -0.353378
+-0.603585 -0.349067 -0.303421 0.568272 0.740359 0.867822 0.197278 -0.810242
+-0.33022 -0.0861883 0.426628 0.358067 0.089432 -0.742347 0.0222928
+0.154434 -0.825422 -0.881904 0.12682 0.350987 0.0897385 -0.786109 -0.39361
+-0.144684 -1.29256 0.138787 0.269566 -0.406094 0.326972 1.23654 -0.913955
+0.136856 0.393125 0.600884 -0.594596 -0.413174 0.214951 0.200585 0.175857
+-1.01752 -0.31549 0.504388 1.163 -0.0296288 0.995619 0.106042 0.16855
+0.455215 -0.637398 -0.150702 0.249129 0.135166 -1.26096 -0.797095 0.934975
+0.0588951 0.536533 -0.239387 0.448714 0.284336 -0.656581 -0.133826
+0.924105 -0.511581 0.643558 -0.136664 0.624789 -0.0196189 -0.464937
+-0.279151 0.163041 0.121887 0.449057 0.532464 0.718517 0.176426 0.868419
+1.14193 0.257007 -0.911972 0.0465374 -0.732001 -0.250816 0.122471 0.726056
+-1.12058 0.389353 0.14151 -1.14237 -0.0550604 0.814202 -0.384609 -0.681333
+0.0583124 0.321552 -0.536972 0.632089 0.438287 -0.910892 0.0458107
+0.68507 -0.696387 -0.606794 0.431702 0.447796 -1.00196 0.827565 0.507481
+0.692209 0.365319 -0.477962 -1.01353 -0.289242 0.2492 -0.63864 -0.0308495
+-0.964849 -0.131568 0.203899 -0.0724887 -0.844895 -0.0582342 0.100405
+-0.991055 0.237091 0.312951 -0.487238 0.0841217 -0.156907 -0.924262
+0.532736 -1.01376 0.649347 0.0738764 1.10073 -0.00238037 1.1651 0.651116
+0.224517 0.494785 -0.548638 0.776208 0.19802 0.222794 0.839639 -0.832099
+0.820033 0.425205 0.650704 0.0449457 0.612989 0.35025 -0.0866652 -0.998908
+0.0416984 0.715 0.0830671 0.38009 0.732109 -0.0311126 -1.23906 0.900689
+-0.309951 0.27042 -0.587731 1.40664 0.519979 0.0618286 0.0853498 0.491693
+-0.356254 0.41959 0.130254 -1.1254 -0.480674 -0.202988 -1.08244 -0.100898
+-0.140422 -0.915615 0.557089 -0.591041 0.850997 -0.00363538 -0.383306
+-1.25208 -0.627543 -1.1102 -0.159031 -1.24027 0.213968 0.474747 -0.12998
+-0.21186 0.29542 -0.148525 -0.0417887 0.0519037 -0.114662 -0.162537
+0.692914 0.0197687 -0.180372 0.813145 0.713259 -0.0895147 -0.279669
+-0.488144 -0.571116 0.192803 1.21437 0.368565 0.738682 -0.664527 1.1523
+0.0522766 0.749558 0.682244 -0.172944 -0.0135154 -0.504828 0.701867
+-0.807286 -0.599472 0.654693 -0.511909 0.0832251 0.838779 -1.72845
+0.134667 -0.568823 -0.276306 0.472171 -0.0146551 -0.513462 -0.324551
+-0.815246 -0.241126 -0.964588 -0.404159 0.857997 -0.450995 -0.381217
+-0.222256 0.179857 -0.425513 -0.248731 -0.0305362 -0.203699 0.17907
+-1.86013 0.317539 -0.969948 -0.918494 -0.0972777 -0.941269 -0.40066
+0.000542641 0.78784 0.826084 0.336655 0.154931 -0.608128 0.262756 -0.0925054
+-0.736579 0.378851 0.162754 -1.47089 0.169763 -0.301058 -0.0701752
+0.68927 -0.157294 -1.19281 0.202549 -1.13501 0.626 -0.117718 0.186584
+0.241299 -0.261603 0.0452756 0.164219 0.429982 0.523644 -1.42163 0.216934
+0.188335 0.700494 0.143638 -0.405361 0.137908 0.362695 -0.998202 -0.0673218
+0.48326 -0.396003 0.230942 0.306309 0.730709 1.26815 -0.0547033 0.306778
+0.40708 1.44891 0.513973 0.658604 -1.22154 0.365014 -0.220285 0.0268478
+1.56893 -0.639777 -0.722354 0.573399 -1.32066 0.278283 0.454026 0.246231
+-1.09395 0.587945 0.884996 -0.433681 -0.34032 0.00795841 -0.50467 0.238831
+0.683842 0.632073 0.777185 -0.659512 -0.22608 -0.94596 -0.991149 0.279434
+-0.5042 -0.132392 0.473501 0.536533 -0.095372 -0.208472 -0.32206 0.056427
+0.263557 0.419549 0.571356 0.0763283 -0.237502 0.470422 0.764071 0.0626373
+-0.763131 -0.0871038 -1.25371 0.334873 0.886347 -0.159278 1.10684 -0.0678101
+0.993616 0.47265 -0.248044 0.171543 0.643119 0.652429 0.123981 -0.521347
+-0.560194 0.348809 -0.57985 0.476963 -0.772117 -0.844459 -0.188666
+-0.0203846 -1.19043 0.166375 -0.339218 -0.045742 -0.336168 0.35006
+-1.25712 -0.316269 -1.33484 0.675347 0.461888 0.290928 0.802284 1.36099
+0.0707114 0.210754 -0.103043 0.250726 -0.11037 0.0650978 -0.677317
+-0.186683 0.525059 0.214981 0.723472 -0.85749 0.0882964 1.10489 0.732596
+-0.667945 1.41427 -0.13855 0.691333 -0.0242987 -0.719702 0.347813 0.367718
+1.1672 -0.375178 0.347794 -0.324705 0.500299 -0.233827 0.340733 1.39187
+-0.306251 0.621311 0.180969 0.87824 0.216302 -0.0754177 0.661777 -0.203015
+-0.463294 0.446463 0.209122 0.831174 -0.751288 1.21231 -0.329678 0.403141
+0.321069 0.721127 0.190998 -0.606773 -0.152472 1.16428 0.100742 0.85853
+1.42184 -0.355721 -0.413925 -0.248344 1.13775 -0.606483 -0.546963 0.639468
+-0.535987 -0.00698299 0.081604 -0.57816 -0.505622 0.591187 0.0240822
+0.0504005 0.322595 -0.877434 -0.0701751 0.247287 0.167413 -0.473422
+-0.545498 0.223894 1.37258 0.966277 -0.100891 1.39963 -0.218146 0.0471014
+-0.161953 -0.879357 -0.511024 1.03562 0.0802155 1.37861 -0.287299 1.07829
+-0.465908 -0.470534 0.296777 -0.579796 -0.0844116 -0.987868 1.20995
+0.62382 -0.0511132 0.0673051 0.545983 0.787745 0.341934 1.45619 -0.601386
+0.765464 0.785557 0.17923 0.361596 0.384095 -0.0979461 0.194904 -0.84632
+-0.336861 0.809727 -0.861567 0.243615 -0.966771 -0.0936127 1.04055
+0.600152 0.554882 0.0370217 0.046233 1.19204 1.13725 -0.0387573 0.133491
+1.23803 0.756855 -0.423183 -0.167927 0.956872 0.676372 0.238419 0.942244
+0.442315 -0.336654 -0.852138 0.253523 -0.21189 1.20896 -0.0528564 -0.736563
+-0.661994 0.746766 0.593906 -0.103726 -0.814246 1.87147 -0.0858001
+1.22183 0.550103 -0.442347 0.539951 0.174145 0.524804 0.37852 0.241028
+-0.729709 -0.421393 -0.275332 0.0328712 -0.670919 -0.319739 -0.977175
+-0.605331 -0.810161 -0.951484 -0.0454004 -0.161709 -1.56885 0.152123
+-0.324764 0.0587652 1.0896 0.0848322 1.03236 -0.0437889 -0.621459 0.440392
+0.784727 -0.337753 0.406829 -0.187446 -0.179017 -0.160244 -1.10242
+-0.204932 0.3784 -0.179138 0.906909 -0.518317 -0.738366 -0.136074 -0.457299
+-0.408851 0.0614769 -0.2108 0.683344 0.467217 0.3736 0.0912209 -0.303519
+-1.54636 0.0173089 -0.129542 0.157766 -1.10584 0.254292 0.0528908 -0.430391
+-0.242469 1.00737;
+#A 1000 -0.630722 0.0799302 -0.612494 1.07925 0.530186 0.200905 -0.872169
+0.37126 -0.333762 -0.472282 0.572259 0.102128 0.0856056 -0.542689 -0.435462
+0.0267038 -0.898033 0.907135 0.948419 0.654722 0.286204 1.0339 0.0853827
+-0.0303865;
+#X coords 0 1 1024 -1 200 140 1;
+#X restore 481 79 graph;
+#X obj 61 119 osc~ 440;
+#N canvas 0 0 450 300 graph1 0;
+#X array array2 55 float 5;
+#A 0 48 76 64 38 37 33 30 24 62 71 29 35 64 62 63 47 37 44 38 41 55
+26 17 49 73 41 37 43 55 56 58 49 34 25 51 85 54 51 73 73 69 23 8 0
+4 56 85 137 105 46 25 24 26 4 0;
+#X coords 0 200 54 0 200 140 1;
+#X restore 492 320 graph;
+#X obj 161 214 unpack~;
+#X obj 161 236 tabsend~ array2;
+#X obj 600 18 block~ 1024;
+#X obj 35 200 tabsend~ array1;
+#X obj 161 192 wdv~ 1024 50;
+#X obj 62 148 expr~ if($f3 == 1 \, $v1 \, $v2);
+#X obj 159 120 noise~;
+#X obj 254 121 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 115 8 An attempt at implementing Wavelet Dispersion Vectors
+as described by Stephan Rein (but slightly different);
+#X connect 0 0 7 0;
+#X connect 0 0 8 0;
+#X connect 2 0 9 0;
+#X connect 4 0 5 0;
+#X connect 8 0 4 0;
+#X connect 9 0 0 0;
+#X connect 10 0 9 1;
+#X connect 11 0 9 2;
+#X restore 13 5 pd sub;
diff --git a/flib/gpl.txt b/flib/gpl.txt
new file mode 100644
index 0000000..3912109
--- /dev/null
+++ b/flib/gpl.txt
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/flib/makefile b/flib/makefile
new file mode 100644
index 0000000..d690fc0
--- /dev/null
+++ b/flib/makefile
@@ -0,0 +1,161 @@
+# Makefile hacked together from various others, mostly the old zexy makefile I think. All credit to IOhannes Zmoelnig and anyone else who understands make better than me.
+#
+# Should work with Linux and OS X. No idea about Windows.
+
+NAME=flib
+CSYM=flib
+
+current: pd_linux
+
+DESTDIR =
+INSTALL_PREFIX = /usr/local
+PDLIBDIR = /lib/pd
+PDDIR = $(INSTALL_PREFIX)$(PDLIBDIR)
+
+TARGETS = sc~ ss~ irreg~ mspec~ peak~ pspec~ sfm~ trist~ pp~ bmax~ melf~ clean~ wdv~ hca~
+
+
+# ----------------------- NT -----------------------
+
+pd_nt: src/$(NAME).dll
+
+.SUFFIXES: .dll
+
+PDNTCFLAGS = /W3 /WX /MD /O2 /G6 /DNT /DPD /nologo
+VC="C:\Programme\Microsoft Visual Studio\VC98"
+
+PDNTINCLUDE = /I. /Ic:\pd\tcl\include /Ic:\pd\src /I$(VC)\include /Iinclude
+
+PDNTOBJECTS = $(TARGETS:%=%.obj)
+
+PDNTLDIR = $(VC)\Lib
+PDNTLIB = $(PDNTLDIR)\msvcrt.lib \
+ $(PDNTLDIR)\oldnames.lib \
+ $(PDNTLDIR)\kernel32.lib \
+ $(PDNTLDIR)\user32.lib \
+ $(PDNTLDIR)\uuid.lib \
+ $(PDNTLDIR)\ws2_32.lib \
+ $(PDNTLDIR)\pthreadVC.lib \
+ c:\pd\bin\pd.lib
+
+.c.dll:
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/sc~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/ss~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/irreg~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/mspec~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/peak~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/pspec~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/sfm~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/trist~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/pp~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/bmax~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/melf~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/clean~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/wdv~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c src/hca~.c
+ $(CC) $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
+ link /dll /export:$(CSYM)_setup $(NAME).obj $(PDNTOBJECTS) $(PDNTLIB)
+
+
+# ----------------------- Mac OS X (Darwin) -----------------------
+
+
+pd_darwin: src/$(NAME).pd_darwin
+
+.SUFFIXES: .pd_darwin
+
+DARWINCFLAGS = -DPD -DUNIX -DMACOSX -O2 \
+ -Wall -W -Wno-shadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+# where is your m_pd.h ???
+DARWININCLUDE = -I ../src -I../../src -I../../obj -I/Applications/Pd-0.38-4-extended-RC1.app/Contents/Resources/include
+
+DARWINOBJECTS = $(TARGETS:%=%.o)
+
+.c.pd_darwin:
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/sc~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/ss~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/irreg~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/mspec~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/peak~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/pspec~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/sfm~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/trist~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/pp~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/bmax~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/melf~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/clean~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/wdv~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c src/hca~.c
+ $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -c $*.c
+ $(CC) -bundle -undefined suppress -flat_namespace -o $(NAME).pd_darwin $(NAME).o $(DARWINOBJECTS)
+ rm -f $(NAME).o ../$(NAME).pd_darwin
+ ln -s $(NAME)/$(NAME).pd_darwin ..
+
+darwin_package: pd_darwin
+ test -d root/doc/5.reference || mkdir -p root/doc/5.reference
+ -cp help/* root/doc/5.reference
+ test -d root/extra || mkdir -p root/extra
+ install -m644 *.pd_darwin root/extra
+ open darwin_package.pmsp
+
+darwin_altpackage: pd_darwin
+ test -d root/Help || mkdir -p root/Help
+ -cp help/* root/Help
+ test -d root/Externals || mkdir -p root/Externals
+ install -m644 *.pd_darwin root/Externals
+ open darwin_altpackage.pmsp
+
+# ----------------------- LINUX i386 -----------------------
+
+pd_linux: src/$(NAME).pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXOBJECTS = $(TARGETS:%=%.o)
+ARCH = $(shell uname --machine)
+
+PD_DIR = $(DESTDIR)$(INSTALL_PREFIX)$(PDLIBDIR)
+
+ifeq (${ARCH},alpha)
+AFLAGS = -mieee -mcpu=ev56
+endif
+
+
+$(LINUXOBJECTS): *.h
+
+LINUXCFLAGS = -DPD -O2 -fPIC -funroll-loops -Wall -W -Wshadow -Wstrict-prototypes -Werror -fomit-frame-pointer -Wno-unused -Wno-parentheses -Wno-switch $(AFLAGS)
+
+LINUXINCLUDE = -I/usr/include
+
+
+.c.pd_linux:
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/sc~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/ss~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/irreg~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/mspec~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/peak~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/pspec~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/sfm~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/trist~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/pp~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/bmax~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/melf~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/clean~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/wdv~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c src/hca~.c
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -c $*.c
+ ld -export_dynamic -shared -o $(NAME).pd_linux $(NAME).o $(LINUXOBJECTS) -lc -lm
+ strip --strip-unneeded $(NAME).pd_linux
+
+# ----------------------------------------------------------
+
+install:
+ install -d $(PDDIR)/doc/5.reference/flib
+ cp doc/help-* $(PDDIR)/doc/5.reference/flib
+ install -d $(PDDIR)/externs
+ install -m 644 *.pd_linux $(PD_DIR)/externs
+
+clean:
+ rm -f *.o *.pd_* so_locations
diff --git a/flib/src/bmax~.c b/flib/src/bmax~.c
new file mode 100644
index 0000000..e3bb5a1
--- /dev/null
+++ b/flib/src/bmax~.c
@@ -0,0 +1,103 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the maximum sample value in each frame*/
+
+#include "flib.h"
+static t_class *bmax_class;
+
+typedef struct _bmax {
+ t_object x_obj;
+ t_float f,x;
+ t_int I; /*instances of blockmax to find */
+ t_outlet *M_out, *I_out;
+} t_bmax;
+
+
+static t_float max(t_float *array, t_int size){
+ register t_float t = array[0];
+ register t_int i;
+ for(i = 1; i < size; i++){
+ if (t < array[i])
+ t = array[i];
+ }
+ return t;
+}
+
+static t_int *bmax_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_bmax *x = (t_bmax *)(w[2]);
+ t_int N = (t_int)(w[3]);
+ t_float blockmax;
+ t_int maxloc[x->I], i, j;
+ t_atom argv[x->I];
+
+ /* argv = getbytes(x->I * sizeof(t_atom)); */
+
+ blockmax = max(in,N);
+
+ for(i = 0, j = 0; i < N; i++){
+ if (in[i] == blockmax && j < x->I)
+ maxloc[j++] = i;
+ }
+
+ if (j < x->I)
+ for(; j < x->I; maxloc[j++] = 0); /* zero out the rest of the array */
+
+ for(i = 0; i < x->I; i++)
+ SETFLOAT(argv+i, maxloc[i]);
+
+ outlet_float(x->M_out, blockmax);
+ outlet_list(x->I_out, &s_list, x->I, argv);
+
+ return (w+5);
+}
+
+static void bmax_dsp(t_bmax *x, t_signal **sp)
+{
+ dsp_add(bmax_perform, 4,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *bmax_new(t_floatarg f)
+{
+ t_bmax *x = (t_bmax *)pd_new(bmax_class);
+ if (!f)
+ x->I = 1;
+ else
+ x->I = (t_int)floor(f);
+ x->M_out = outlet_new(&x->x_obj, &s_float);
+ x->I_out = outlet_new(&x->x_obj, &s_list);
+ return (void *)x;
+}
+
+
+void bmax_tilde_setup(void) {
+ bmax_class = class_new(gensym("bmax~"),
+ (t_newmethod)bmax_new,
+ 0, sizeof(t_bmax),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ class_addmethod(bmax_class,
+ (t_method)bmax_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(bmax_class, t_bmax,f);
+ class_sethelpsymbol(bmax_class, gensym("help-flib"));
+}
diff --git a/flib/src/clean~.c b/flib/src/clean~.c
new file mode 100644
index 0000000..1261357
--- /dev/null
+++ b/flib/src/clean~.c
@@ -0,0 +1,87 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* cleans 'nan' 'inf' '-inf' from an audio vector */
+
+#include "flib.h"
+static t_class *clean_class;
+
+typedef struct _clean {
+ t_object x_obj;
+ t_float f;
+ t_outlet *out_r;
+} t_clean;
+
+static t_int *clean_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
+ t_int N = (t_int)(w[3]);
+ t_clean *x = (t_clean *)(w[4]);
+
+
+ while(N--){
+ if(finite(*in))
+ *out++ = *in++;
+ else
+ *out++ = 0;
+ }
+ return (w+5);
+}
+
+static void clean_dsp(t_clean *x, t_signal **sp)
+{
+ dsp_add(clean_perform, 4,
+ sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n, x);
+}
+
+static void clean_float(t_clean *x, t_float f)
+{
+ x->f = f;
+ if(!x->f || !finite(x->f))
+ outlet_float(x->out_r, 0);
+ else
+ outlet_float(x->out_r, x->f);
+
+}
+
+
+
+static void *clean_new(void)
+{
+ t_clean *x = (t_clean *)pd_new(clean_class);
+ outlet_new(&x->x_obj, &s_signal);
+ x->out_r = outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void clean_tilde_setup(void) {
+ clean_class = class_new(gensym("clean~"),
+ (t_newmethod)clean_new,
+ 0, sizeof(t_clean),
+ CLASS_DEFAULT, 0);
+
+ CLASS_MAINSIGNALIN(clean_class, t_clean,f);
+ class_addfloat(clean_class, clean_float);
+ class_addmethod(clean_class,
+ (t_method)clean_dsp, gensym("dsp"), 0);
+ class_sethelpsymbol(clean_class, gensym("help-flib"));
+}
diff --git a/flib/src/flib.c b/flib/src/flib.c
new file mode 100644
index 0000000..6bb1015
--- /dev/null
+++ b/flib/src/flib.c
@@ -0,0 +1,61 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "flib.h"
+
+typedef struct flib
+{
+ t_object t_ob;
+} t_flib;
+
+t_class *flib_class;
+
+void *flib_new(void)
+{
+ t_flib *x = (t_flib *)pd_new(flib_class);
+ return (void *)x;
+}
+
+
+void flib_setup(void)
+{
+ int i;
+
+ char *ext[] = {"sc~\t\tSpectral Centroid", "ss~\t\tSpectral Smoothness", "irreg~\t\tSpectral Irregularity (methods 1 and 2)", "mspec~\t\tMagnitude Spectrum", "peak~\t\tAmplitude and Frequency of Spectral Peaks", "pspec~\t\tPhase Spectrum", "sfm~\t\tSpectral Flatness Measure", "trist~\t\tTristimulus (x,y,z)", "++~\t\tSum of the samples in each block", "bmax~\t\tThe maximum value and location(s) each block", "melf~\t\tGenerate a mel spaced filter for fft", "clean~\t\tRemoves NaN, inf and -inf from a signal vector", "wdv~\t\tCalculate a wavelet dispersion vector (requires creb)", "hca~\t\tHarmonic component analysis"};
+ sc_tilde_setup();
+ ss_tilde_setup();
+ pp_tilde_setup();
+ bmax_tilde_setup();
+ irreg_tilde_setup();
+ mspec_tilde_setup();
+ peak_tilde_setup();
+ pspec_tilde_setup();
+ sfm_tilde_setup();
+ trist_tilde_setup();
+ melf_tilde_setup();
+ clean_tilde_setup();
+ wdv_tilde_setup();
+ hca_tilde_setup();
+
+ post("\n\tflib "VERSION" Feature Extraction Library\n\tby Jamie Bullock\n");
+
+ for(i = 0; i < 14; i++)
+ post("\t%s",ext[i]);
+
+ flib_class = class_new(gensym("flib"), flib_new, 0, sizeof(t_flib), 0, 0);
+}
diff --git a/flib/src/flib.h b/flib/src/flib.h
new file mode 100644
index 0000000..0cb4b4c
--- /dev/null
+++ b/flib/src/flib.h
@@ -0,0 +1,40 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "m_pd.h"
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define VERSION "0.8"
+
+void sc_tilde_setup(void);
+void ss_tilde_setup(void);
+void pp_tilde_setup(void);
+void bmax_tilde_setup(void);
+void irreg_tilde_setup(void);
+void mspec_tilde_setup(void);
+void peak_tilde_setup(void);
+void pspec_tilde_setup(void);
+void sfm_tilde_setup(void);
+void trist_tilde_setup(void);
+void melf_tilde_setup(void);
+void clean_tilde_setup(void);
+void wdv_tilde_setup(void);
+void hca_tilde_setup(void);
+
diff --git a/flib/src/ha~.c b/flib/src/ha~.c
new file mode 100644
index 0000000..39a46d6
--- /dev/null
+++ b/flib/src/ha~.c
@@ -0,0 +1,85 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope thcat it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should hcave received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+/* Perform hcarmonic analysis on a signal given the fundamental frequency and the frequency/amplitude spectra */
+
+/* Can measure hcarmonicity or ratio of inhcarmonic frequencies to to hcarmonic frequencies, or the relative proportion of some other series such as odd or even hcarmonics */
+
+
+#include "flib.h"
+
+static t_class *hca_class;
+
+typedef struct _hca {
+ t_object x_obj;
+ t_float f;
+ t_int p;
+} t_hca;
+
+static t_int *hca_perform(t_int *w)
+{
+ t_sample *in1 = (t_sample *)(w[1]);
+ t_int N = (t_int)(w[2]),n;
+ t_int p = (t_int)(w[3]);
+
+
+
+ post("x->p = %.2f", x->p);
+
+
+
+ return (w+4);
+}
+
+static void hca_dsp(t_hca *x, t_signal **sp)
+{
+ dsp_add(hca_perform, 3,
+ sp[0]->s_vec, sp[0]->s_n, x->p);
+
+}
+
+static void *hca_new(t_floatarg f)
+{
+ t_hca *x = (t_hca *)pd_new(hca_class);
+ if(!f)
+ x->p = 0;
+ else
+ x->p = f;
+ inlet_new(&x->x_obj, &s_float);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+void hca_float(t_hca *x, t_float f){
+ x->p = f;
+}
+
+void hca_tilde_setup(void) {
+ hca_class = class_new(gensym("hca~"),
+ (t_newmethod)hca_new,
+ 0, sizeof(t_hca),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ class_addmethod(hca_class,
+ (t_method)hca_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(hca_class, t_hca,f);
+
+ class_addfloat(hca_class, hca_float)
+
+ class_sethelpsymbol(hca_class, gensym("help-flib"));
+}
diff --git a/flib/src/hca~.c b/flib/src/hca~.c
new file mode 100644
index 0000000..2317324
--- /dev/null
+++ b/flib/src/hca~.c
@@ -0,0 +1,108 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope thcat it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should hcave received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+/* Perform hcarmonic analysis on a signal given the fundamental frequency and the frequency/amplitude spectra */
+
+/* Takes fundamental through right inlet and % allowed deviation from actual harmonic to be considered harmonic as argument. Outputs number of partials, number of harmonics, number of even harmonics */
+
+#include "flib.h"
+
+static t_class *hca_class;
+
+typedef struct _hca {
+ t_object x_obj;
+ t_float f;
+ t_float fund, deviation;
+ t_outlet *p_out, *h_out, *e_out;
+} t_hca;
+
+static t_int *hca_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_int N = (t_int)(w[2]),n;
+ t_hca *x = (t_hca *)(w[3]);
+ t_int npartials, nharmonics, neven, harmonic;
+ t_float partial, harmonicity;
+
+ neven = nharmonics = npartials = 0;
+
+ while(N--){
+ if(in[N]){
+ npartials++;
+ partial = in[N] / x->fund;
+ harmonic = (t_int)rintf(partial);
+ if(partial <= harmonic + x->deviation &&
+ partial >= harmonic - x->deviation){
+ nharmonics++;
+ if(harmonic / 2.0f == rint(harmonic / 2.0f))
+ neven++;
+ }
+ }
+ }
+
+ if(!npartials)
+ post("hca~: No partials found.");
+
+
+ outlet_float(x->p_out, npartials);
+ outlet_float(x->h_out, nharmonics);
+ outlet_float(x->e_out, neven);
+
+ return (w+4);
+}
+
+static void hca_dsp(t_hca *x, t_signal **sp)
+{
+ dsp_add(hca_perform, 3,
+ sp[0]->s_vec, sp[0]->s_n, x);
+
+}
+
+static void *hca_new(t_floatarg f)
+{
+ t_hca *x = (t_hca *)pd_new(hca_class);
+ if(!f)
+ x->deviation = 0;
+ else
+ x->deviation = f * .01;
+
+ post("deviation = %.2f", x->deviation);
+
+ if(!x->fund)
+ x->fund = 0;
+
+ floatinlet_new(&x->x_obj, &x->fund);
+ x->p_out = outlet_new(&x->x_obj, &s_float);
+ x->h_out = outlet_new(&x->x_obj, &s_float);
+ x->e_out = outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+void hca_tilde_setup(void) {
+ hca_class = class_new(gensym("hca~"),
+ (t_newmethod)hca_new,
+ 0, sizeof(t_hca),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ class_addmethod(hca_class,
+ (t_method)hca_dsp, gensym("dsp"), 0);
+
+ CLASS_MAINSIGNALIN(hca_class, t_hca,f);
+
+ class_sethelpsymbol(hca_class, gensym("help-flib"));
+}
diff --git a/flib/src/irreg~.c b/flib/src/irreg~.c
new file mode 100644
index 0000000..7616c63
--- /dev/null
+++ b/flib/src/irreg~.c
@@ -0,0 +1,70 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the spectral irreg of one frame according to Jensen et al 1999*/
+
+#include "flib.h"
+static t_class *irreg_class;
+
+typedef struct _irreg {
+ t_object x_obj;
+ t_float f,x;
+} t_irreg;
+
+static t_int *irreg_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_irreg *x = (t_irreg *)(w[2]);
+ t_int N = (t_int)(w[3]),M = N >> 1,n;
+ t_float I = 0, X = 0,Y = 0;
+ for(n = 1; n < M; n++){
+ X += in[n] - in[n+1];
+ Y += in[n] * in[n];
+ }
+ I = X / Y;
+ outlet_float(x->x_obj.ob_outlet, I);
+ return (w+4);
+}
+
+static void irreg_dsp(t_irreg *x, t_signal **sp)
+{
+ dsp_add(irreg_perform, 3,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *irreg_new(void)
+{
+ t_irreg *x = (t_irreg *)pd_new(irreg_class);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void irreg_tilde_setup(void) {
+ irreg_class = class_new(gensym("irreg~"),
+ (t_newmethod)irreg_new,
+ 0, sizeof(t_irreg),
+ CLASS_DEFAULT,0);
+
+ class_addmethod(irreg_class,
+ (t_method)irreg_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(irreg_class, t_irreg,f);
+ class_sethelpsymbol(irreg_class, gensym("help-flib"));
+}
diff --git a/flib/src/melf~.c b/flib/src/melf~.c
new file mode 100644
index 0000000..06947dc
--- /dev/null
+++ b/flib/src/melf~.c
@@ -0,0 +1,218 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates a series of freq_bands Mel filters for multiplication by an fft power spectrum */
+
+#include "flib.h"
+static t_class *melf_class;
+
+typedef struct _melf {
+ t_object x_obj;
+ t_float f;
+ t_int sr;
+ t_float nyquist;
+ t_int freq_bands;
+ t_int n_filters;
+ t_int fft_size;
+ char style;
+ t_float freq_min;
+ t_float freq_max;
+ t_float freq_min_mel;
+ t_float freq_max_mel;
+ t_float freq_bw_mel;
+ t_float norm;
+ t_float *mel_peak;
+ t_float *lin_peak;
+ t_int *fft_peak;
+ t_float *height_norm;
+ t_float **fft_tables; /* tables to hold the filters */
+ t_outlet *graph_outlet; /*outlet for list of coeffs */
+} t_melf;
+
+static t_int *melf_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_melf *x = (t_melf *)(w[3]);
+ t_int n_filter = x->n_filters;
+ t_int N = (t_int)(w[2]), n;
+ t_float out = 0;
+ t_atom outs[x->n_filters];
+
+ while(n_filter--){
+ t_float *filter = x->fft_tables[n_filter];
+ n = N;
+ while(n--){
+ out += in[N - n - 1] * *filter++;
+ }
+ SETFLOAT(&outs[n_filter], out);
+ }
+ outlet_list(x->graph_outlet, &s_list, x->n_filters, outs);
+
+ return (w+4);
+}
+
+static void melf_dsp(t_melf *x, t_signal **sp)
+{
+ int n;
+ dsp_add(melf_perform, 3,
+ sp[0]->s_vec, sp[0]->s_n, x);
+}
+
+static void *melf_new(t_symbol *s, t_int argc, t_atom *argv)
+{
+ t_int n,i;
+ t_float norm_fact, height, inc, val;
+ t_melf *x = (t_melf *)pd_new(melf_class);
+ x->n_filters = 0;
+
+ x->sr = (t_int)sys_getsr();
+ x->nyquist = x->sr * .5;
+
+ for(i = 0; i < argc; i++, argv++){
+ if(argv->a_type == A_FLOAT)
+ switch(i){
+ case 5: x->norm = argv->a_w.w_float;
+ break;
+ case 4: x->fft_size = argv->a_w.w_float;
+ break;
+ case 3: post("arg 4 should always be 'a' or 'g'");
+ break;
+ case 2: x->freq_max = argv->a_w.w_float;
+ break;
+ case 1: x->freq_min = argv->a_w.w_float;
+ break;
+ case 0: x->freq_bands = argv->a_w.w_float;
+ break;
+ }
+ else if(argv->a_type == A_SYMBOL){
+ x->style = (char)argv->a_w.w_symbol->s_name[0];
+ }
+ }
+
+ if (!x->freq_bands)
+ x->freq_bands = 60;
+
+ if(!x->freq_min || x->freq_min < 0)
+ x->freq_min = 0;
+
+ if(!x->freq_max || x->freq_max > x->nyquist)
+ x->freq_max_mel = x->nyquist;
+ else
+ x->freq_max_mel = x->freq_max;
+
+ if(x->style != 'g' && x->style != 'a')
+ x->style = 'g';
+
+ if(!x->fft_size || (x->fft_size - 1) & x->fft_size)
+ x->fft_size = 512;
+ post("fft size = %d", x->fft_size);
+
+ if(!x->norm || x->norm < 0 || x->norm > 20)
+ x->norm = 1;
+
+ x->freq_min_mel = 1127 * log10(1 + x->freq_min / 700);
+ x->freq_bw_mel = (x->freq_max_mel - x->freq_min_mel) / x->freq_bands;
+
+ x->mel_peak = getbytes((x->freq_bands + 2) * sizeof(t_float)); /* +2 for zeros at start and end */
+ x->lin_peak = getbytes((x->freq_bands + 2) * sizeof(t_float));
+ x->fft_peak = getbytes((x->freq_bands + 2) * sizeof(t_int));
+ x->height_norm = getbytes(x->freq_bands * sizeof(t_float));
+
+ x->mel_peak[0] = x->freq_min_mel;
+ x->lin_peak[0] = (700 * (exp(x->mel_peak[0]/1127) - 1));
+ x->fft_peak[0] = (t_int)rint(x->lin_peak[0]/x->nyquist * (x->fft_size / 2));
+
+ for (n = 1; n <= x->freq_bands; n++) /*roll out peak locations - mel, linear and linear on fft window scale */
+ {
+ x->mel_peak[n] = x->mel_peak[n - 1] + x->freq_bw_mel;
+ x->lin_peak[n] = (700 * (exp(x->mel_peak[n]/1127) - 1));
+ x->fft_peak[n] = (t_int)rint(x->lin_peak[n]/x->nyquist * (x->fft_size / 2));
+ }
+
+ for (n = 0; n <= x->freq_bands && x->lin_peak[n + 1] < x->freq_max_mel; n++) /*roll out normalised gain of each peak*/
+ {
+ if (x->style == 'g'){
+ height = 1;
+ norm_fact = x->norm;
+ }
+ else{
+ height = 2 / (x->lin_peak[n + 2] - x->lin_peak[n]);
+ norm_fact = x->norm / (2 / (x->lin_peak[2] - x->lin_peak[0]));
+ }
+ x->height_norm[n] = height * norm_fact;
+ x->n_filters = n;
+ }
+
+ post("Number of linear mel-spaced filters = %d", x->n_filters);
+
+ x->fft_tables = (float **)getbytes(x->n_filters * sizeof(float *));
+ for(n = 0; n < x->n_filters; n++)
+ x->fft_tables[n] = (float *)getbytes(x->fft_size * sizeof(float));
+
+ i = 0;
+
+ for(n = 0; n < x->n_filters; n++){
+ if(n > 0)/*calculate the rise increment*/
+ inc = x->height_norm[n] / (x->fft_peak[n] - x->fft_peak[n - 1]);
+ else
+ inc = x->height_norm[n] / x->fft_peak[n];
+ val = 0;
+ for(; i <= x->fft_peak[n]; i++){ /*fill in the 'rise' */
+ x->fft_tables[n][i] = val;
+ val += inc;
+ }
+ inc = x->height_norm[n] / (x->fft_peak[n + 1] - x->fft_peak[n]);/*calculate the fall increment */
+ val = 0;
+ for(i = x->fft_peak[n + 1]; i > x->fft_peak[n]; i--){ /*reverse fill the 'fall' */
+ x->fft_tables[n][i] = val;
+ val += inc;
+ }
+ }
+ x->graph_outlet = outlet_new(&x->x_obj, &s_list);
+
+
+ return (void *)x;
+}
+
+static void melf_free(t_melf *x){
+ int N;
+ N = x->n_filters;
+ while(N--)
+ freebytes(x->fft_tables[N], sizeof(t_float) * x->fft_size);
+ freebytes(x->fft_tables, sizeof(t_float *) * x->n_filters);
+ freebytes(x->mel_peak,(x->freq_bands + 2) * sizeof(t_float));
+ freebytes(x->lin_peak, (x->freq_bands + 2) * sizeof(t_float));
+ freebytes(x->fft_peak, (x->freq_bands + 2) * sizeof(t_int));
+ freebytes(x->height_norm, x->freq_bands * sizeof(t_float));
+}
+
+
+
+void melf_tilde_setup(void) {
+ melf_class = class_new(gensym("melf~"),
+ (t_newmethod)melf_new,
+ (t_method)melf_free, sizeof(t_melf),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(melf_class,
+ (t_method)melf_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(melf_class, t_melf,f);
+ class_sethelpsymbol(melf_class, gensym("help-mfcc"));
+}
diff --git a/flib/src/mspec~.c b/flib/src/mspec~.c
new file mode 100644
index 0000000..02000cd
--- /dev/null
+++ b/flib/src/mspec~.c
@@ -0,0 +1,89 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* Compute the magnitude spectrum of a signal given the real and imaginary components of an fft. The output maximum is normalised to 1. If an argument of 2 is given, the power spectrum is output */
+
+#include "flib.h"
+#define SQ(a) (a * a)
+
+static t_class *mspec_class;
+
+typedef struct _mspec {
+ t_object x_obj;
+ t_float f;
+ t_int p;
+} t_mspec;
+
+static t_int *mspec_perform(t_int *w)
+{
+ t_sample *in1 = (t_sample *)(w[1]);
+ t_sample *in2 = (t_sample *)(w[2]);
+ t_sample *out = (t_sample *)(w[3]);
+ t_int N = (t_int)(w[4]),n;
+ t_int p = (t_int)(w[5]);
+ if(p == 2){
+ for (n = 0; n < N; n++){
+ if(in1[n] != 0 && in2[n] != 0)
+ *out++ = (SQ(in1[n]) + SQ(in2[n])) / N;
+ else
+ *out++ = 0;
+ }
+ }
+ else{
+ for (n = 0; n < N; n++){
+ if(in1[n] != 0 && in2[n] != 0)
+ *out++ = q8_sqrt(SQ(in1[n]) + SQ(in2[n])) / N;
+ else
+ *out++ = 0;
+ }
+ }
+ return (w+6);
+}
+
+static void mspec_dsp(t_mspec *x, t_signal **sp)
+{
+ dsp_add(mspec_perform, 5,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n, x->p);
+}
+
+static void *mspec_new(t_floatarg f)
+{
+ t_mspec *x = (t_mspec *)pd_new(mspec_class);
+ if(f == 2)
+ x->p = 2;
+ else
+ x->p = 0;
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ return (void *)x;
+}
+
+
+void mspec_tilde_setup(void) {
+ mspec_class = class_new(gensym("mspec~"),
+ (t_newmethod)mspec_new,
+ 0, sizeof(t_mspec),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ class_addmethod(mspec_class,
+ (t_method)mspec_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(mspec_class, t_mspec,f);
+ class_sethelpsymbol(mspec_class, gensym("help-flib"));
+}
diff --git a/flib/src/peak~.c b/flib/src/peak~.c
new file mode 100644
index 0000000..fdc1e6a
--- /dev/null
+++ b/flib/src/peak~.c
@@ -0,0 +1,129 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/*Outputs amplitude (in dB referenecd to a maximum of 100dB) and frequency of spectral peaks from outlets 1 and 2. A peak is defined as a bin that has a greater magnitude than either of its neighbouring bins. A peak detection threshold is given by the first argument (or right inlet as a float) as a percentage of the frame maximum, i.e. a setting of 100 finds peaks equal to the size of the highest peak, a setting of 0 will output all peaks. Default is 0*/
+
+#include "flib.h"
+#define SQ(a) (a * a)
+
+static t_class *peak_class;
+
+typedef struct _peak {
+ t_object x_obj;
+ t_float f, thresh, *buf;
+ t_int sr,M;
+} t_peak;
+
+static t_float max(t_float *array, t_int size){
+ register t_float t = array[0];
+ register t_int i;
+ for(i = 1; i < size; i++){
+ if (t < array[i])
+ t = array[i];
+ }
+ return t;
+}
+
+static t_int *peak_perform(t_int *w)
+{
+ t_sample *in1 = (t_sample *)(w[1]);
+ t_sample *out1 = (t_float *)(w[2]);
+ t_sample *out2 = (t_float *)(w[3]);
+ t_int N = (t_int)(w[4]), M = N >> 1,n;
+ t_float thresh = *(t_float *)(w[5]);
+ t_peak *x = (t_peak *)(w[6]);
+ t_float width = (t_float)x->sr / (t_float)N,y,y2,y3,p,t;
+
+ x->M = M;
+ x->buf = getbytes(M * sizeof(t_float));
+
+ for(n = 0; n < M; n++){
+ if ((t = in1[n] * 100000) >= 1) /* ensure we never take log10(0) */
+ x->buf[n] = t;
+ else
+ x->buf[n] = 1;
+ }
+
+ if(thresh < 0 || thresh > 100)
+ thresh = 0;
+ else
+ thresh *= .01 * max(&x->buf[0],M);
+
+ out1[0] = 0;
+ out2[0] = 0;
+
+ for(n = 1; n < M; n++){
+ if(x->buf[n] >= thresh){
+ if(x->buf[n] > x->buf[n - 1] && x->buf[n] > x->buf[n + 1]){
+ out1[n] = width * (n + (p = .5 * (y = 20 * log10(x->buf[n-1]) - (y3 = 20 * log10(x->buf[n+1]))) / (20 * log10(x->buf[n - 1]) - 2 * (y2 = 20 * log10(x->buf[n])) + 20 * log10(x->buf[n + 1]))));
+ out2[n] = y2 - .25 * (y - y3) * p;
+ }
+ else{
+ out1[n] = 0;
+ out2[n] = 0;
+ }
+ }
+ else{
+ out1[n] = 0;
+ out2[n] = 0;
+ }
+ }
+
+ for (;n < N; n++){
+ out1[n] = 0;
+ out2[n] = 0;
+ }
+
+ return (w+7);
+
+}
+
+static void peak_dsp(t_peak *x, t_signal **sp)
+{
+ dsp_add(peak_perform, 6, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n,&x->thresh, x);
+}
+
+static void *peak_new(t_symbol *s, t_int argc, t_atom *argv)
+{
+ t_peak *x = (t_peak *)pd_new(peak_class);
+ floatinlet_new(&x->x_obj, &x->thresh);
+ outlet_new(&x->x_obj, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->sr = (t_int)sys_getsr();
+ x->thresh = atom_getfloatarg(0,argc, argv);
+
+ return (void *)x;
+}
+
+static void peak_free(t_peak *x){
+ freebytes(x->buf, sizeof(t_float) * x->M);
+}
+
+void peak_tilde_setup(void) {
+ peak_class = class_new(gensym("peak~"),
+ (t_newmethod)peak_new,
+ (t_method)peak_free, sizeof(t_peak),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(peak_class, (t_method)peak_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(peak_class, t_peak,f);
+ class_sethelpsymbol(peak_class, gensym("help-flib"));
+
+}
diff --git a/flib/src/pp~.c b/flib/src/pp~.c
new file mode 100644
index 0000000..862a51e
--- /dev/null
+++ b/flib/src/pp~.c
@@ -0,0 +1,70 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the sum of the samples in each frame*/
+
+#include "flib.h"
+static t_class *pp_class;
+
+typedef struct _pp {
+ t_object x_obj;
+ t_float f,x;
+} t_pp;
+
+static t_int *pp_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_pp *x = (t_pp *)(w[2]);
+ t_int N = (t_int)(w[3]);
+ float sum = 0;
+
+ while(N--)
+ sum += *in++;
+
+ outlet_float(x->x_obj.ob_outlet, sum);
+ return (w+4);
+}
+
+static void pp_dsp(t_pp *x, t_signal **sp)
+{
+ dsp_add(pp_perform, 3,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *pp_new(void)
+{
+ t_pp *x = (t_pp *)pd_new(pp_class);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void pp_tilde_setup(void) {
+ pp_class = class_new(gensym("pp~"),
+ (t_newmethod)pp_new,
+ 0, sizeof(t_pp),
+ CLASS_DEFAULT,0);
+
+ class_addcreator((t_newmethod)pp_new, gensym("++~"), A_DEFFLOAT, 0);
+ class_addmethod(pp_class,
+ (t_method)pp_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(pp_class, t_pp,f);
+ class_sethelpsymbol(pp_class, gensym("help-flib"));
+}
diff --git a/flib/src/pspec~.c b/flib/src/pspec~.c
new file mode 100644
index 0000000..80512c5
--- /dev/null
+++ b/flib/src/pspec~.c
@@ -0,0 +1,77 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* Compute the phase (in radians) spectrum of a signal given the real and imaginary components of an fft */
+
+#include "flib.h"
+#define SQ(a) (a * a)
+
+static t_class *pspec_class;
+
+typedef struct _pspec {
+ t_object x_obj;
+ t_float f;
+} t_pspec;
+
+static t_int *pspec_perform(t_int *w)
+{
+ t_sample *in1 = (t_sample *)(w[1]);
+ t_sample *in2 = (t_sample *)(w[2]);
+ t_sample *out = (t_sample *)(w[3]);
+ t_int N = (t_int)(w[4]),n;
+ t_float piv2 = M_PI * .5;
+ for (n = 0; n < N; n++){
+ if(in1[n] == 0 && in2[n] == 0 || in1[n] == 0)
+ *out++ = 0;
+ else if(in2[n] == 0)
+ *out++ = piv2;
+ else
+ *out++ = atanf(in1[n] / in2[n]);
+ }
+ return (w+5);
+}
+
+static void pspec_dsp(t_pspec *x, t_signal **sp)
+{
+ dsp_add(pspec_perform, 4,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
+}
+
+static void *pspec_new(void)
+{
+ t_pspec *x = (t_pspec *)pd_new(pspec_class);
+
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ return (void *)x;
+}
+
+
+void pspec_tilde_setup(void) {
+ pspec_class = class_new(gensym("pspec~"),
+ (t_newmethod)pspec_new,
+ 0, sizeof(t_pspec),
+ CLASS_DEFAULT, 0);
+
+ class_addmethod(pspec_class,
+ (t_method)pspec_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(pspec_class, t_pspec,f);
+ class_sethelpsymbol(pspec_class, gensym("help-flib"));
+}
diff --git a/flib/src/sc~.c b/flib/src/sc~.c
new file mode 100644
index 0000000..47c69f5
--- /dev/null
+++ b/flib/src/sc~.c
@@ -0,0 +1,77 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the spectral sc of one frame, given peak frequency and amplitude to first and second inputs respectively */
+
+#include "flib.h"
+
+static t_class *sc_class;
+
+typedef struct _sc {
+ t_object x_obj;
+ t_float f, x;
+} t_sc;
+
+static t_int *sc_perform(t_int *w)
+{
+ t_sample *in1 = (t_sample *)(w[1]);
+ t_sample *in2 = (t_sample *)(w[2]);
+ t_sc *x = (t_sc *)(w[3]);
+ t_int N = (t_int)(w[4]),M = N >> 1,n;
+ t_float FA = 0,A = 0,C;
+ for (n = 0; n < M; n++){
+ if (in2[n] != 0){
+ FA += in1[n] * in2[n];
+ A += in2[n];
+ }
+ }
+ C = FA / A;
+ outlet_float(x->x_obj.ob_outlet, C);
+ return (w+5);
+}
+
+static void sc_dsp(t_sc *x, t_signal **sp)
+{
+ dsp_add(sc_perform, 4,
+ sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
+}
+
+static void *sc_new(void)
+{
+ t_sc *x = (t_sc *)pd_new(sc_class);
+
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void sc_tilde_setup(void) {
+ sc_class = class_new(gensym("sc~"),
+ (t_newmethod)sc_new,
+ 0, sizeof(t_sc),
+ CLASS_DEFAULT,
+ A_DEFFLOAT, 0);
+
+ class_addmethod(sc_class,
+ (t_method)sc_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(sc_class, t_sc,f);
+ class_sethelpsymbol(sc_class, gensym("help-flib"));
+}
diff --git a/flib/src/sfm~.c b/flib/src/sfm~.c
new file mode 100644
index 0000000..ee745c2
--- /dev/null
+++ b/flib/src/sfm~.c
@@ -0,0 +1,75 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates spectral flatness measure as described by Tae Hong Park*/
+
+#include "m_pd.h"
+#include <math.h>
+
+static t_class *sfm_class;
+
+typedef struct _sfm {
+ t_object x_obj;
+ t_float f,x;
+} t_sfm;
+
+static t_int *sfm_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_sfm *x = (t_sfm *)(w[2]);
+ t_int N = (t_int)(w[3]),M = (N >> 1) - 1,n;
+ t_float F, A = 0, G = 1;
+ t_float iM = 1 / (float)M;
+ for(n = 0; n < M; n++){
+ if(in[n] !=0){
+ G *= in[n];
+ A += in[n];
+ }
+ }
+ F = 10 * log10(pow(G, iM) / (iM * A));
+ outlet_float(x->x_obj.ob_outlet, F);
+ return (w+4);
+}
+
+static void sfm_dsp(t_sfm *x, t_signal **sp)
+{
+ dsp_add(sfm_perform, 3,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *sfm_new(void)
+{
+ t_sfm *x = (t_sfm *)pd_new(sfm_class);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void sfm_tilde_setup(void) {
+ sfm_class = class_new(gensym("sfm~"),
+ (t_newmethod)sfm_new,
+ 0, sizeof(t_sfm),
+ CLASS_DEFAULT,0);
+
+ class_addmethod(sfm_class,
+ (t_method)sfm_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(sfm_class, t_sfm,f);
+ class_sethelpsymbol(sfm_class, gensym("help-flib"));
+}
diff --git a/flib/src/ss~.c b/flib/src/ss~.c
new file mode 100644
index 0000000..8ad1caa
--- /dev/null
+++ b/flib/src/ss~.c
@@ -0,0 +1,71 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the spectral smoothness of one frame according to Krimphoff et al. 1994*/
+
+#include "flib.h"
+static t_class *ss_class;
+
+typedef struct _ss {
+ t_object x_obj;
+ t_float f,x;
+} t_ss;
+
+static t_int *ss_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_ss *x = (t_ss *)(w[2]);
+ t_int N = (t_int)(w[3]),M = N >> 1,n;
+ t_float I = 0, buf[M];
+ for(n = 0; n < M; buf[n++] = *in++);
+ for(n = 2; n < M - 1; n++){
+ if(buf[n] != 0 && buf[n-1] != 0 && buf[n+1] != 0)
+ I += (buf[n] - (buf[n-1] + buf[n] + buf[n+1]) / 3);
+ }
+
+ outlet_float(x->x_obj.ob_outlet, I);
+ return (w+4);
+}
+
+static void ss_dsp(t_ss *x, t_signal **sp)
+{
+ dsp_add(ss_perform, 3,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *ss_new(void)
+{
+ t_ss *x = (t_ss *)pd_new(ss_class);
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void ss_tilde_setup(void) {
+ ss_class = class_new(gensym("ss~"),
+ (t_newmethod)ss_new,
+ 0, sizeof(t_ss),
+ CLASS_DEFAULT,0);
+
+ class_addmethod(ss_class,
+ (t_method)ss_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(ss_class, t_ss,f);
+ class_sethelpsymbol(ss_class, gensym("help-flib"));
+}
diff --git a/flib/src/trist~.c b/flib/src/trist~.c
new file mode 100644
index 0000000..93fd3b9
--- /dev/null
+++ b/flib/src/trist~.c
@@ -0,0 +1,92 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates tristimulus of one frame according to method outlined by Pollard and Jansson. First argument determines method used (x,y, or z) */
+
+#include "flib.h"
+static t_class *trist_class;
+
+typedef struct _trist {
+ t_object x_obj;
+ t_float f,x;
+ t_symbol *t;
+} t_trist;
+
+static t_int *trist_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_trist *x = (t_trist *)(w[2]);
+ t_int N = (t_int)(w[3]),M = (N >> 1) - 1,n,i = 0;
+ t_float T, A = 0,p1 = 0,p2 = 0,p3 = 0,p4 = 0,p5 = 0;
+
+ for(n = 0; n < M; n++){
+ A += in[n];
+ if (in[n] != 0 && i < 5){
+ switch(i){
+ case 4: p5 = in[n]; i++;
+ break;
+ case 3: p4 = in[n]; i++;
+ break;
+ case 2: p3 = in[n]; i++;
+ break;
+ case 1: p2 = in[n]; i++;
+ break;
+ case 0: p1 = in[n]; i++;
+ break;
+ }
+ }
+ }
+ if (*x->t->s_name == 'z')
+ T = p1 / A;
+ else if (*x->t->s_name == 'y')
+ T = (p2 + p3 + p4) / A;
+ else
+ T = (A - p1 + p2 + p3 + p4 + p5) / A;
+
+ outlet_float(x->x_obj.ob_outlet, T);
+ return (w+4);
+}
+
+static void trist_dsp(t_trist *x, t_signal **sp)
+{
+ dsp_add(trist_perform, 3,
+ sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *trist_new(t_symbol *s)
+{
+ t_trist *x = (t_trist *)pd_new(trist_class);
+ x->t = s;
+ outlet_new(&x->x_obj, &s_float);
+ return (void *)x;
+}
+
+
+void trist_tilde_setup(void) {
+ trist_class = class_new(gensym("trist~"),
+ (t_newmethod)trist_new,
+ 0, sizeof(t_trist),
+ CLASS_DEFAULT, A_DEFSYMBOL, 0);
+
+ class_addmethod(trist_class,
+ (t_method)trist_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(trist_class, t_trist,f);
+ class_sethelpsymbol(trist_class, gensym("help-flib"));
+}
diff --git a/flib/src/wdv~.c b/flib/src/wdv~.c
new file mode 100644
index 0000000..dfca9fd
--- /dev/null
+++ b/flib/src/wdv~.c
@@ -0,0 +1,234 @@
+/* flib - PD library for feature extraction
+Copyright (C) 2005 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+
+/* calculates the wavelet dispersion vector from the output of dwt from creb*/
+
+/* First argument gives the DSP block size, second argument gives the amount of data reduction in the output vector as a percentage */
+
+#include "flib.h"
+
+#define ISPOWEROFTWO(n) (!((n-1) & n))
+
+
+static t_class *wdv_class;
+
+typedef struct _coeff {
+ t_int scale;
+ t_float val;
+} t_coeff;
+
+static void divisi(t_float *, t_coeff **, int , int );
+
+typedef struct _wdv {
+ t_object x_obj;
+ t_float f;
+ t_coeff **ranktab;
+ t_int **histo, *vector;
+ t_int N, M, scales, vecsize, offset;
+ t_outlet *out_vec;
+} t_wdv;
+
+
+static t_int compare(t_coeff *x, t_coeff *y){ /*sorts in descending order */
+ if( x->val > y->val)
+ return -1;
+ else if (x->val < y->val)
+ return 1;
+ else
+ return 0;
+}
+
+static t_int bitcount(t_int x){
+ t_int i=0;
+ while(!(x & 01)){
+ i++;
+ x >>= 1;
+ }
+ return i;
+}
+
+static void divisi(t_float *arrayin, t_coeff **arrayout, int N, int scales){
+
+ t_int row, elements, nelements, n, p, i, j, col;
+ t_float scaling;
+ row = N / 2;
+ col = scales;
+ nelements = elements = row;
+ n = N - 1;
+
+ scaling = arrayin[0] / scales; /* hmmm - include this or not ? */
+
+ for(i = 0; i < row; i++)
+ arrayout[i][0].val = scaling;
+ /* Copy the scaling function to all rows */
+
+ while(col--){
+ row = 0;
+ for(i = 0; i < elements; i++, n--){
+ p = nelements / elements;
+ for(j = 0; j < p; j++)
+ arrayout[row++][col].val =
+ arrayin[n] / (t_float)(scales - col);
+ /* divide by reverse scale no. to avg over the block */
+ }
+
+ elements /= 2;
+ }
+
+}
+
+static t_int *wdv_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_int N = (t_int)(w[2]);
+ t_wdv *x = (t_wdv *)(w[3]);
+ t_int i, j, k, n, scale;
+ t_atom atom_list_out[x->vecsize];
+
+
+ /* ensure our blocksize matches block~ size */
+
+ if(N != x->N){
+ post("First argument must equal DSP block size!");
+ return (w+4);
+ }
+
+
+ /* Zero histogram and populate scale entries */
+
+ for (i = 0; i < x->scales; i++)
+ memset(&x->histo[i][0], 0, x->scales * sizeof(t_int));
+
+
+ for(i = 0; i < x->M; i++){
+ for(j = 0, scale = x->scales; j < x->scales; j++, scale--)
+ x->ranktab[i][j].scale = scale;
+ }
+
+
+ /* Tabulate data and average scales accross columns */
+
+ divisi(&in[0], &x->ranktab[0], x->N, x->scales);
+
+
+ /* Calulate the rank value for each scale in place. Array index gives rank */
+
+ for(i = 0; i < x->M; i++)
+ qsort(&x->ranktab[i][0], x->scales,
+ sizeof(t_coeff), (void *)compare);
+
+
+
+ /* Create rank/scale matrix */
+
+ for(i = 0; i < x->scales; i++){
+ for(j = 0; j < x->M; j++)
+ x->histo[x->ranktab[j][i].scale - 1][i]++;
+ }
+
+
+ /* Generate output vector */
+
+ k = x->scales - x->offset;
+
+ for(n = 0, i = x->offset; i < k; i++){
+ for(j = 0; j < x->scales; j++)
+ x->vector[n++] = x->histo[i][j];
+ }
+
+ for(i = 0; i < x->vecsize; i++)
+ SETFLOAT(atom_list_out+i, x->vector[i]);
+
+ outlet_list(x->out_vec, &s_list, x->vecsize, atom_list_out);
+
+ return (w+4);
+}
+
+static void wdv_dsp(t_wdv *x, t_signal **sp)
+{
+ dsp_add(wdv_perform, 3,
+ sp[0]->s_vec, sp[0]->s_n, x);
+}
+
+static void *wdv_new(t_symbol *s, t_int argc, t_atom *argv)
+{
+ t_wdv *x = (t_wdv *)pd_new(wdv_class);
+ x->out_vec = outlet_new(&x->x_obj, &s_list);
+
+ t_int i, j, m, scale, rowsize, compression;
+
+ x->N = (t_int)atom_getfloatarg(0, argc, argv);
+ x->M = x->N * .5f;
+ x->scales = bitcount(x->N) + 1;
+ compression = (t_int)atom_getfloatarg(1, argc, argv);
+ x->offset = rintf((100 - compression) * x->scales * .01 * .5);
+ x->vecsize = (x->scales - x->offset * 2) * x->scales;
+ rowsize = scale = x->scales;
+ m = x->M;
+
+ if(!ISPOWEROFTWO(x->N))
+ post("invalid blocksize, must be a power of two");
+ else
+ post("blocksize = %d, scales = %d, vectorsize = %d, offset = %d",
+ x->N, x->scales, x->vecsize, x->offset);
+
+ x->vector = (t_int *)getbytes(x->vecsize * sizeof(t_int));
+
+ x->ranktab = (t_coeff **)getbytes(x->M * sizeof(t_coeff *));
+
+ while(m--)
+ x->ranktab[m] = (t_coeff *)getbytes(x->scales * sizeof(t_coeff));
+
+ x->histo = (t_int **)getbytes(x->scales * sizeof(t_int *));
+
+ while(scale--)
+ x->histo[scale] = (t_int *)getbytes(x->scales * sizeof(t_int));
+
+
+ return (void *)x;
+}
+
+static void wdv_tilde_free(t_wdv *x){
+ t_int i;
+
+ for(i = 0; i < x->M; i++)
+ free(x->ranktab[i]);
+ free(x->ranktab);
+
+ for(i = 0; i < x->scales; i++)
+ free(x->histo[i]);
+ free(x->histo);
+
+ free(x->vector);
+
+/* freebytes(x->buf, x->blocks * sizeof(t_coeff)); */
+}
+
+
+void wdv_tilde_setup(void) {
+ wdv_class = class_new(gensym("wdv~"),
+ (t_newmethod)wdv_new,
+ 0, sizeof(t_wdv),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(wdv_class, (t_method)wdv_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(wdv_class, t_wdv,f);
+ class_sethelpsymbol(wdv_class, gensym("help-flib"));
+}