aboutsummaryrefslogtreecommitdiff
path: root/externals/build
diff options
context:
space:
mode:
authorEd Kelly <edkelly@users.sourceforge.net>2005-12-01 11:22:08 +0000
committerEd Kelly <edkelly@users.sourceforge.net>2005-12-01 11:22:08 +0000
commit08596048cf2b13cfba6d7fabe5ad5604875d9a45 (patch)
treead228864bcce3220f169366d40849aeb11722f4f /externals/build
parentbeff9cda2230f9e51c49b54566e98e90d5f5a81b (diff)
This commit was generated by cvs2svn to compensate for changes in r4096,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=4097
Diffstat (limited to 'externals/build')
-rw-r--r--externals/build/src/cup.c42
-rw-r--r--externals/build/src/doubledelta.c48
-rw-r--r--externals/build/src/framescore~.c101
-rw-r--r--externals/build/src/framespect~.c111
-rw-r--r--externals/build/src/hssc~.c98
-rw-r--r--externals/build/src/listmoses.c149
-rw-r--r--externals/build/src/lpc~.c203
-rw-r--r--externals/build/src/lpreson~.c131
-rw-r--r--externals/build/src/peakit~.c138
-rw-r--r--externals/build/src/simile.c69
-rw-r--r--externals/build/src/simile~.c84
-rw-r--r--externals/build/src/steady.c80
-rw-r--r--externals/build/src/voicing_detector~.c131
-rw-r--r--externals/build/src/zeroxpos~.c101
14 files changed, 1486 insertions, 0 deletions
diff --git a/externals/build/src/cup.c b/externals/build/src/cup.c
new file mode 100644
index 00000000..6aca2141
--- /dev/null
+++ b/externals/build/src/cup.c
@@ -0,0 +1,42 @@
+#include "m_pd.h"
+
+t_class *cup_class;
+
+typedef struct _cup
+{
+ t_object x_obj;
+ t_int f_count, fa;
+ t_outlet *count;
+} t_cup;
+
+void cup_float(t_cup *y, t_floatarg f)
+{
+ y->f_count = f;
+}
+
+void cup_bang(t_cup *y)
+{
+ outlet_float(y->count, y->f_count);
+ y->f_count += 1;
+}
+
+void *cup_new(t_floatarg f)
+{
+ t_cup *y = (t_cup *)pd_new(cup_class);
+ y->fa = f;
+ y->f_count = 0;
+ y->count = outlet_new(&y->x_obj, gensym("float"));
+ return(void *)y;
+}
+
+void cup_setup(void)
+{
+ cup_class = class_new(gensym("cup"),
+ (t_newmethod)cup_new,
+ 0, sizeof(t_cup),
+ 0, A_DEFFLOAT, 0);
+ post("cup counts up ^_^");
+ class_sethelpsymbol(cup_class, gensym("help-cup"));
+ class_addbang(cup_class, cup_bang);
+ class_addfloat(cup_class, cup_float);
+}
diff --git a/externals/build/src/doubledelta.c b/externals/build/src/doubledelta.c
new file mode 100644
index 00000000..9da52b12
--- /dev/null
+++ b/externals/build/src/doubledelta.c
@@ -0,0 +1,48 @@
+#include "m_pd.h"
+
+t_class *doubledelta_class;
+
+typedef struct _doubledelta
+{
+ t_object x_obj;
+ t_int f_now, f_prev, f_delta, f_delta_prev, f_doubledelta, fa;
+ t_outlet *delta, *doubledelta;
+} t_doubledelta;
+
+void doubledelta_float(t_doubledelta *y, t_floatarg f)
+{
+ y->f_delta_prev = y->f_delta;
+ y->f_prev = y->f_now;
+ y->f_now = f;
+ y->f_delta = y->f_now - y->f_prev;
+ y->f_doubledelta = y->f_delta - y->f_delta_prev;
+ outlet_float(y->doubledelta, y->f_doubledelta);
+ outlet_float(y->delta, y->f_delta);
+}
+
+void doubledelta_bang(t_doubledelta *y)
+{
+ outlet_float(y->doubledelta, y->f_doubledelta);
+ outlet_float(y->delta, y->f_delta);
+}
+
+void *doubledelta_new(t_floatarg f)
+{
+ t_doubledelta *y = (t_doubledelta *)pd_new(doubledelta_class);
+ y->fa = f;
+ y->delta = outlet_new(&y->x_obj, gensym("float"));
+ y->doubledelta = outlet_new(&y->x_obj, gensym("float"));
+ return(void *)y;
+}
+
+void doubledelta_setup(void)
+{
+ doubledelta_class = class_new(gensym("doubledelta"),
+ (t_newmethod)doubledelta_new,
+ 0, sizeof(t_doubledelta),
+ 0, A_DEFFLOAT, 0);
+ post("delta & delta-delta values, <morph_2016@yahoo.co.uk>");
+ class_sethelpsymbol(doubledelta_class, gensym("help-ddelta"));
+ class_addbang(doubledelta_class, doubledelta_bang);
+ class_addfloat(doubledelta_class, doubledelta_float);
+}
diff --git a/externals/build/src/framescore~.c b/externals/build/src/framescore~.c
new file mode 100644
index 00000000..71a6d39b
--- /dev/null
+++ b/externals/build/src/framescore~.c
@@ -0,0 +1,101 @@
+/*
+ * framescore~ : Weighted block comparison.
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+
+static t_class *framescore_tilde_class;
+
+typedef struct _framescore_tilde
+{
+ t_object x_obj;
+ t_float f;
+ t_float f_max, f_win, f_accum;
+ t_outlet *f_score;
+} t_framescore_tilde;
+
+t_int *framescore_tilde_perform(t_int *w)
+{
+ t_framescore_tilde *x = (t_framescore_tilde *)(w[1]);
+ t_sample *in1 = (t_sample *)(w[2]);
+ t_sample *in2 = (t_sample *)(w[3]);
+ int n = (int)(w[4]);
+ float vector1;
+ float vector2;
+ x->f_accum = 0;
+ float block_accum = 0;
+ x->f_max = 0;
+ float score = 0;
+ float avg = 0;
+ int block = n;
+ x->f_win = x->f_win > 0 ? x->f_win : 0.01;
+
+ while (n--)
+ {
+ vector1 = (*in1++);
+ vector2 = (*in2++);
+ vector1 = vector1 > 0 ? vector1 : 0 - vector1;
+ vector2 = vector2 > 0 ? vector2 : 0 - vector2;
+ block_accum += vector2;
+ x->f_max = vector2 > x->f_max ? vector2 : x->f_max;
+ float diff = vector1 > vector2 ? vector1 - vector2 : vector2 - vector1;
+ x->f_accum += (1/((diff/x->f_win)+1)) * vector2;
+ }
+ score = x->f_accum / x->f_max;
+ block_accum /= x->f_max;
+ avg = score / block_accum;
+ outlet_float(x->f_score, avg);
+
+ return(w+5);
+}
+
+void framescore_tilde_dsp(t_framescore_tilde *x, t_signal **sp)
+{
+ dsp_add(framescore_tilde_perform, 4, x,
+ sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+void *framescore_tilde_new(t_floatarg f)
+{
+ t_framescore_tilde *x = (t_framescore_tilde *)pd_new(framescore_tilde_class);
+
+ x->f_win = f;
+
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ floatinlet_new (&x->x_obj, &x->f_win);
+ x->f_score = outlet_new(&x->x_obj, gensym("float"));
+
+ return (void *)x;
+}
+
+
+void framescore_tilde_setup(void)
+{
+ framescore_tilde_class = class_new(gensym("framescore~"),
+ (t_newmethod)framescore_tilde_new,
+ 0, sizeof(t_framescore_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|+++++++++++framescore~+++++++++++++|");
+ post("|+++++weighted block comparison+++++|");
+ post("|+++edward+++++++kelly+++++++2005+++|");
+
+ class_addmethod(framescore_tilde_class, (t_method)framescore_tilde_dsp,
+ gensym("dsp"), 0);
+ class_sethelpsymbol(framescore_tilde_class, gensym("help-framescore~"));
+ CLASS_MAINSIGNALIN(framescore_tilde_class, t_framescore_tilde, f);
+}
diff --git a/externals/build/src/framespect~.c b/externals/build/src/framespect~.c
new file mode 100644
index 00000000..c4618988
--- /dev/null
+++ b/externals/build/src/framespect~.c
@@ -0,0 +1,111 @@
+/*
+ * framespect~ : Weighted alpha comparison, block-by-block.
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+#include <math.h>
+
+static t_class *framespect_tilde_class;
+
+typedef struct _framespect_tilde
+{
+ t_object x_obj;
+ t_float f;
+ t_float f_max, f_win, f_accum;
+ t_outlet *f_score;
+} t_framespect_tilde;
+
+t_int *framespect_tilde_perform(t_int *w)
+{
+ t_framespect_tilde *x = (t_framespect_tilde *)(w[1]);
+ t_sample *real1 = (t_sample *)(w[2]);
+ t_sample *imag1 = (t_sample *)(w[3]);
+ t_sample *real2 = (t_sample *)(w[4]);
+ t_sample *imag2 = (t_sample *)(w[5]);
+ int n = (int)(w[6]);
+ float r1, i1, r2, i2;
+ float vector1;
+ float vector2;
+ x->f_accum = 0;
+ float block_accum = 0;
+ x->f_max = 0;
+ float score = 0;
+ float avg = 0;
+ int block = n;
+ x->f_win = x->f_win > 0 ? x->f_win : 0.01;
+
+ while (n--)
+ {
+ r1 = (*real1++);
+ i1 = (*imag1++);
+ r2 = (*real2++);
+ i2 = (*imag2++);
+ vector1 = sqrt((r1 * r1) + (i1 * i1));
+ vector2 = sqrt((r2 * r2) + (i2 * i2));
+ vector1 = vector1 > 0 ? vector1 : 0 - vector1;
+ vector2 = vector2 > 0 ? vector2 : 0 - vector2;
+ block_accum += vector2;
+ x->f_max = vector2 > x->f_max ? vector2 : x->f_max;
+ float diff = vector1 > vector2 ? vector1 - vector2 : vector2 - vector1;
+ x->f_accum += (1/((diff/x->f_win)+1)) * vector2;
+ }
+ score = x->f_accum / x->f_max;
+ block_accum /= x->f_max;
+ avg = score / block_accum;
+ outlet_float(x->f_score, avg);
+
+ return(w+7);
+}
+
+void framespect_tilde_dsp(t_framespect_tilde *x, t_signal **sp)
+{
+ dsp_add(framespect_tilde_perform, 6, x,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n);
+}
+
+void *framespect_tilde_new(t_floatarg f)
+{
+ t_framespect_tilde *x = (t_framespect_tilde *)pd_new(framespect_tilde_class);
+
+ x->f_win = f;
+
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ floatinlet_new (&x->x_obj, &x->f_win);
+ x->f_score = outlet_new(&x->x_obj, gensym("float"));
+
+ return (void *)x;
+}
+
+
+void framespect_tilde_setup(void)
+{
+ framespect_tilde_class = class_new(gensym("framespect~"),
+ (t_newmethod)framespect_tilde_new,
+ 0, sizeof(t_framespect_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|'''''''''''framespect~'''''''''''''|");
+ post("|'''''weighted alpha comparison'''''|");
+ post("|'''edward'''''''kelly'''''''2005'''|");
+
+ class_addmethod(framespect_tilde_class, (t_method)framespect_tilde_dsp,
+ gensym("dsp"), 0);
+ class_sethelpsymbol(framespect_tilde_class, gensym("help-framespect~"));
+ CLASS_MAINSIGNALIN(framespect_tilde_class, t_framespect_tilde, f);
+}
diff --git a/externals/build/src/hssc~.c b/externals/build/src/hssc~.c
new file mode 100644
index 00000000..f62ad9de
--- /dev/null
+++ b/externals/build/src/hssc~.c
@@ -0,0 +1,98 @@
+/*
+ * hssc~ : Highest Significant Spectral Component, according to amplitude ratio to
+ * Strongest Significant Spectral Component.
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+#include <math.h>
+
+static t_class *hssc_tilde_class;
+
+typedef struct _hssc_tilde
+{
+ t_object x_obj;
+ t_float f;
+ t_float f_maxbin, f_minbin, f_ratio;
+ t_outlet *f_hssc, *f_sssc;
+} t_hssc_tilde;
+
+t_int *hssc_tilde_perform(t_int *w)
+{
+ t_hssc_tilde *x = (t_hssc_tilde *)(w[1]);
+ t_sample *real = (t_sample *)(w[2]);
+ t_sample *imag = (t_sample *)(w[3]);
+ int n = (int)(w[4]);
+ int incr = 0;
+ double vectorr, vectori;
+ double max = 0;
+ double alpha;
+ x->f_maxbin = x->f_minbin = 0;
+ x->f_ratio = x->f_ratio > 0 ? x->f_ratio : 100;
+
+ while (n--)
+ {
+ vectorr = (*real++);
+ vectori = (*imag++);
+ alpha = sqrt((vectorr * vectorr) + (vectori * vectori));
+ x->f_maxbin = alpha > max ? incr : x->f_maxbin;
+ max = alpha > max ? alpha : max;
+ x->f_minbin = alpha > (max / x->f_ratio) ? incr : x->f_minbin;
+ incr++;
+ }
+ outlet_float(x->f_sssc, x->f_maxbin);
+ outlet_float(x->f_hssc, x->f_minbin);
+
+ return(w+5);
+}
+
+void hssc_tilde_dsp(t_hssc_tilde *x, t_signal **sp)
+{
+ dsp_add(hssc_tilde_perform, 4, x,
+ sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+void *hssc_tilde_new(t_floatarg f)
+{
+ t_hssc_tilde *x = (t_hssc_tilde *)pd_new(hssc_tilde_class);
+
+ x->f_ratio = f;
+
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ floatinlet_new (&x->x_obj, &x->f_ratio);
+ x->f_hssc = outlet_new(&x->x_obj, gensym("float"));
+ x->f_sssc = outlet_new(&x->x_obj, gensym("float"));
+
+ return (void *)x;
+}
+
+
+void hssc_tilde_setup(void)
+{
+ hssc_tilde_class = class_new(gensym("hssc~"),
+ (t_newmethod)hssc_tilde_new,
+ 0, sizeof(t_hssc_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|=================hssc~==================|");
+ post("|=highest significant spectral component=|");
+ post("|======edward=======kelly=======2005=====|");
+
+ class_addmethod(hssc_tilde_class, (t_method)hssc_tilde_dsp,
+ gensym("dsp"), 0);
+ class_sethelpsymbol(hssc_tilde_class, gensym("help-hssc~"));
+ CLASS_MAINSIGNALIN(hssc_tilde_class, t_hssc_tilde, f);
+}
diff --git a/externals/build/src/listmoses.c b/externals/build/src/listmoses.c
new file mode 100644
index 00000000..864b683b
--- /dev/null
+++ b/externals/build/src/listmoses.c
@@ -0,0 +1,149 @@
+/* listmoses - separate a list according to its contents' values
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+
+static t_class *listmoses_class;
+
+typedef struct _listmoses
+{
+ t_object x_obj;
+ t_atom lowlist[1024];
+ t_atom midlist[1024];
+ t_atom highlist[1024];
+ t_atom lowamps[1024];
+ t_atom midamps[1024];
+ t_atom highamps[1024];
+ t_atom ampslist[1024];
+ t_float lowsplit, highsplit;
+ t_int low_argc, mid_argc, high_argc;
+ t_outlet *low_list, *mid_list, *high_list, *low_buddy, *mid_buddy, *high_buddy;
+} t_listmoses;
+
+void listmoses_list(t_listmoses *x, t_symbol *s, int argc, t_atom *argv)
+{
+ float temp;
+ if (x->highsplit < x->lowsplit)
+ {
+ temp = x->highsplit;
+ x->highsplit = x->lowsplit;
+ x->lowsplit = temp;
+ }
+ float current, curamps;
+ int i;
+ x->low_argc = 0;
+ x->mid_argc = 0;
+ x->high_argc = 0;
+ for (i=0; i<argc; i++)
+ {
+ current = atom_getfloat(argv+i);
+ curamps = atom_getfloatarg(i,argc,x->ampslist);
+ if (current < x->lowsplit)
+ {
+ SETFLOAT(&x->lowlist[x->low_argc], current);
+ SETFLOAT(&x->lowamps[x->low_argc], curamps);
+ x->low_argc++;
+ }
+ else if (current >= x->lowsplit && current < x->highsplit)
+ {
+ SETFLOAT(&x->midlist[x->mid_argc], current);
+ SETFLOAT(&x->midamps[x->mid_argc], curamps);
+ x->mid_argc++;
+ }
+ else
+ {
+ SETFLOAT(&x->highlist[x->high_argc], current);
+ SETFLOAT(&x->highamps[x->high_argc], curamps);
+ x->high_argc++;
+ }
+ }
+ outlet_list(x->high_buddy, gensym("list"), x->high_argc, x->highamps);
+ outlet_list(x->mid_buddy, gensym("list"), x->mid_argc, x->midamps);
+ outlet_list(x->low_buddy, gensym("list"), x->low_argc, x->lowamps);
+ outlet_list(x->high_list, gensym("list"), x->high_argc, x->highlist);
+ outlet_list(x->mid_list, gensym("list"), x->mid_argc, x->midlist);
+ outlet_list(x->low_list, gensym("list"), x->low_argc, x->lowlist);
+}
+
+void listmoses_amps(t_listmoses *x, t_symbol *s, int argc, t_atom *argv)
+{
+ float curamp;
+ int i;
+ for (i=0; i<argc; i++)
+ {
+ curamp = atom_getfloat(argv+i);
+ SETFLOAT (&x->ampslist[i], curamp);
+ }
+}
+
+void listmoses_bang(t_listmoses *x)
+{
+ outlet_list(x->high_buddy, gensym("list"), x->high_argc, x->highamps);
+ outlet_list(x->mid_buddy, gensym("list"), x->mid_argc, x->midamps);
+ outlet_list(x->low_buddy, gensym("list"), x->low_argc, x->lowamps);
+ outlet_list(x->high_list, gensym("list"), x->high_argc, x->highlist);
+ outlet_list(x->mid_list, gensym("list"), x->mid_argc, x->midlist);
+ outlet_list(x->low_list, gensym("list"), x->low_argc, x->lowlist);
+}
+
+void *listmoses_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_listmoses *x = (t_listmoses *)pd_new(listmoses_class);
+ x->highsplit = 96;
+ x->lowsplit = 36;
+/* switch(argc)
+ {
+ default:
+ case 2:
+ x->highsplit = atom_getfloat(argv+1);
+ //x->lowsplit = atom_getfloat(argv);
+ case 1:
+ //x->highsplit = atom_getfloat(argv);
+ x->lowsplit = atom_getfloat(argv);
+ break;
+ case 0:
+ } */ // I don't know why it doesn't work with args!
+
+ x->low_argc = 0;
+ x->mid_argc = 0;
+ x->high_argc = 0;
+
+ x->low_list = outlet_new(&x->x_obj, gensym("list"));
+ x->mid_list = outlet_new(&x->x_obj, gensym("list"));
+ x->high_list = outlet_new(&x->x_obj, gensym("list"));
+ x->low_buddy = outlet_new(&x->x_obj, gensym("list"));
+ x->mid_buddy = outlet_new(&x->x_obj, gensym("list"));
+ x->high_buddy = outlet_new(&x->x_obj, gensym("list"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym("amps"));
+ floatinlet_new(&x->x_obj, &x->lowsplit);
+ floatinlet_new(&x->x_obj, &x->highsplit);
+ return (void *)x;
+}
+
+void listmoses_setup(void) {
+ listmoses_class = class_new(gensym("listmoses"),
+ (t_newmethod)listmoses_new,
+ 0, sizeof(t_listmoses),
+ 0, A_DEFFLOAT, 0);
+ post("|<<<<<<<<<<<<<<<<<<<<<listmoses>>>>>>>>>>>>>>>>>>>>>>|");
+ post("|<<split two lists according to values of the first>>|");
+ post("|<<<<<<<<<<<<edward-------kelly------2005>>>>>>>>>>>>|");
+ class_sethelpsymbol(listmoses_class, gensym("help-listmoses"));
+ class_addbang(listmoses_class, listmoses_bang);
+ class_addlist(listmoses_class, listmoses_list);
+ class_addmethod(listmoses_class, (t_method)listmoses_amps, gensym("amps"), A_GIMME, 0);
+}
diff --git a/externals/build/src/lpc~.c b/externals/build/src/lpc~.c
new file mode 100644
index 00000000..4c4da416
--- /dev/null
+++ b/externals/build/src/lpc~.c
@@ -0,0 +1,203 @@
+/* Linear Predictive Coding - PARCOR and residual generation
+ * Copyright (C) 2005 Nicolas Chetry <okin@altern.org>
+ * and Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+#include <math.h>
+#define MAXPOLES 100
+
+t_class *lpc_tilde_class;
+
+typedef struct _lpc_schur
+{
+ t_float *c_input, *c_residual;
+ /* just so we don't get clicks */
+ t_atom x_last_parcors[MAXPOLES];
+ t_atom x_parcors[MAXPOLES];
+} t_lpc_schur;
+
+typedef struct _lpc_tilde
+{
+ t_object x_obj;
+ t_float f_dummy;
+ t_float x_order, x_lastorder;
+ t_outlet *parcor_list;
+ t_lpc_schur x_schur;
+} t_lpc_tilde;
+
+t_int *lpc_tilde_perform(t_int *w)
+{
+ t_lpc_tilde *x = (t_lpc_tilde *)(w[1]);
+ t_lpc_schur *schur = (t_lpc_schur *)(w[2]);
+ int n = (int)(w[3]);
+ t_float *in = schur->c_input;
+ t_float *res = schur->c_residual;
+// t_float *parcors = schur->PARCORS;
+// t_float *acf = schur->ACF;
+// t_float *k = schur->K;
+// t_float *p = schur->P;
+// t_float *r = schur->r;
+ t_int ord = (int)x->x_order;
+ t_int l_ord = (int)x->x_lastorder;
+// t_float parcors[ord];
+ float acf[ord+1];
+ float k[ord+1];
+ float p[ord+1];
+ float r[ord+1];
+ float mem[ord];
+ int i, j, bid, y, z;
+ int g, h;
+ float tmp, temp, sav, di;
+ float parcor_1;
+ for (i=0; i<ord; i++)
+ {
+ SETFLOAT (&schur->x_parcors[i],0);
+ mem[i] = 0.0;
+ }
+ for (j=0; j<=ord; j++)
+ {
+ acf[j] = 0;
+ for (i=j; i<n; i++)
+ {
+ acf[j] += in[i]*in[i-j];
+ }
+ }
+ if (acf[0] == 0)
+ {
+ for (i=0; i<ord; i++)
+ {
+ SETFLOAT (&schur->x_parcors[i],0);
+ }
+ }
+ for (i=0; i<=ord; i++)
+ {
+ p[i]=acf[i];
+ if (i > 0 && i < ord)
+ {
+ k[ord+1-i] = acf[i];
+ }
+ }
+ /* Schurr recursion */
+ for (y=1; y<=ord; y++)
+ {
+ if (p[0] < fabs (p[1]))
+ {
+ for (i=y; i<=ord; i++)
+ {
+ r[i] = 0;
+ }
+ for (bid=1; bid <=ord; bid++)
+ {
+ SETFLOAT (&schur->x_parcors[bid-1],r[bid]);
+ // x->x_parcors[bid-1] = r[bid];
+ }
+ }
+ r[y] = fabs(p[1])/p[0];
+
+ if (p[1] >0)
+ {
+ r[y] = -1.*r[y];
+ }
+ if (y==ord)
+ {
+ for (bid=1; bid <=ord; bid++)
+ {
+ SETFLOAT (&schur->x_parcors[bid-1],r[bid]);
+ // x->x_parcors[bid-1] = r[bid];
+ }
+ }
+ p[0] += p[1]*r[y];
+
+ for (z=1; z <=ord-y; z++)
+ {
+ p[z] = p[z+1] + k[ord+1-z]*r[y];
+ k[ord+1-z] += p[z+1] * r[y];
+ }
+ }
+ for (bid=1; bid <=ord; bid++)
+ {
+ SETFLOAT (&schur->x_parcors[bid-1],r[bid]);
+ }
+ parcor_1 = atom_getfloatarg(0,ord,schur->x_parcors); /* in order to avoid nil coefficients */
+ if (parcor_1 > 1e-4 || parcor_1 < -1e-4)
+ {
+ outlet_list(x->parcor_list,gensym("list"),ord,schur->x_parcors);
+
+ /* Analysis FIR lattice filtering */
+ for (g=0; g<n; g++)
+ {
+
+ /* Analysis - Lattice structure */
+ sav = di = in[g];
+ for (i=0; i<ord; i++)
+ {
+ t_float parcor = atom_getfloatarg (i,ord,schur->x_parcors);
+ SETFLOAT (&schur->x_last_parcors[i],parcor);
+ x->x_lastorder = ord;
+ temp = mem[i] + parcor*di;
+ di += parcor*mem[i];
+ mem[i] = sav;
+ sav = temp;
+ }
+ res[g] = di;
+
+ } /* next g */
+ }
+ else
+ {
+ outlet_list(x->parcor_list,gensym("list"),l_ord,schur->x_last_parcors);
+ for (g=0; g<n; g++)
+ {
+ res[g] = 0;
+ }
+ }
+ return(w+4);
+}
+
+void *lpc_tilde_dsp(t_lpc_tilde *x, t_signal **sp)
+{
+ x->x_schur.c_input = sp[0]->s_vec;
+ x->x_schur.c_residual = sp[1]->s_vec;
+ dsp_add(lpc_tilde_perform, 3, x, &x->x_schur, sp[0]->s_n);
+ return (void *)x;
+}
+
+void *lpc_tilde_new(t_floatarg f)
+{
+ t_lpc_tilde *x = (t_lpc_tilde *)pd_new(lpc_tilde_class);
+ x->x_order = f >= 1 ? (int)f : 5;
+
+ floatinlet_new(&x->x_obj,&x->x_order);
+ outlet_new(&x->x_obj, &s_signal);
+ x->parcor_list = outlet_new(&x->x_obj, &s_list);
+ return (void *)x;
+}
+
+void lpc_tilde_setup(void)
+{
+ lpc_tilde_class = class_new(gensym("lpc~"), (t_newmethod)lpc_tilde_new, 0, sizeof(t_lpc_tilde), CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("\n. . Linear Predictive Coding. . . . . . . .");
+ post(". . PARCOR coefficients from input. . . . .");
+ post(". . by Nicolas Chetry <okin@altern.org> . .");
+ post(". & Edward Kelly <morph_2016@yahoo.co.uk> .");
+
+ class_addmethod(lpc_tilde_class, (t_method)lpc_tilde_dsp, gensym("dsp"), 0);
+// class_sethelpsymbol(lpc_tilde_class, gensym("help-lpc~"));
+ class_sethelpsymbol(lpc_tilde_class, gensym("lpc_test"));
+ CLASS_MAINSIGNALIN(lpc_tilde_class, t_lpc_tilde, f_dummy);
+}
diff --git a/externals/build/src/lpreson~.c b/externals/build/src/lpreson~.c
new file mode 100644
index 00000000..c89a8e56
--- /dev/null
+++ b/externals/build/src/lpreson~.c
@@ -0,0 +1,131 @@
+/* Lattice IIR filter from PARCOR coefficients
+ * Copyright (C) 2005 Nicolas Chetry <okin@altern.org>
+ * and Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+
+static t_class *lpreson_tilde_class;
+
+typedef struct _lpreson_control
+{
+ t_float *c_residual, *c_output;
+ t_atom *x_parcors;
+ /* t_atom x_parc_interp_one[MAXPOLES];
+ t_int x_parc_ord_one;
+ t_atom x_parc_interp_two[MAXPOLES];
+ t_int x_parc_ord_two; */
+} t_lpreson_control;
+
+typedef struct _lpreson_tilde
+{
+ t_object x_obj;
+ t_float f_dummy;
+ t_int x_order;
+ t_lpreson_control x_ctl;
+} t_lpreson_tilde;
+
+t_int *lpreson_tilde_perform(t_int *w)
+{
+ t_object x_obj;
+ t_lpreson_tilde *x = (t_lpreson_tilde *)(w[1]);
+ t_lpreson_control *ctl = (t_lpreson_control *)(w[2]);
+ int n = (int)(w[3]);
+ t_float *in = ctl->c_residual;
+ t_float *out = ctl->c_output;
+ t_int ord = x->x_order;
+ float mem[ord+1];
+/*
+ * Do the inverse filtering
+ *
+ * 'data_in' : residual signal (length 'len')
+ * 'data_out' : output frame (length 'len')
+ * 'coeff' : the parcor coefficients (length 'tap')
+ * 'lattice_iir' : filter memory - Previously initialised using init_lattice_iir_filter()
+ *
+ */
+ int k, i;
+ float sri;
+
+ for (i=0;i<=ord;i++)
+ {
+ // SETFLOAT (&schur->x_parcors[i],0);
+ mem[i] = 0.0;
+ }
+
+ for (k = 0; k < n; k++ )
+ {
+ /* Synthesis filter - Lattice structure */
+ sri = in[k];
+ for (i=0; i<ord; i++)
+ {
+ t_float parcor = atom_getfloatarg ((ord-1-i),ord,ctl->x_parcors);
+ sri = sri - parcor * mem[ord-1-i];
+ mem[ord-i] = mem[ord-1-i] + parcor*sri;
+ }
+ out[k] = sri;
+ mem[0] = sri;
+
+ } /* next k */
+ return(w+4);
+}
+
+static void lpreson_tilde_list(t_lpreson_tilde *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc)
+ {
+ // x->x_ctl.parc_interp_two = copybytes(x->x_ctl.parc_interp_one, x->x_ctl.parc_ord_one * sizeof(t_atom));
+ // x->x_ctl.parc_ord_two = x->x_ctl.parc_ord_one;
+ // x->x_ctl.parc_interp_one = copybytes(x->x_ctl.parcors, x->x_order * sizeof(t_atom));
+ // x->x_ctl.parc_ord_one = x->x_order;
+ freebytes(x->x_ctl.x_parcors, x->x_order * sizeof(t_atom));
+ }
+
+ x->x_ctl.x_parcors = copybytes(argv, argc * sizeof(t_atom));
+ x->x_order = argc;
+}
+
+void *lpreson_tilde_dsp(t_lpreson_tilde *x, t_signal **sp)
+{
+ x->x_ctl.c_residual = sp[0]->s_vec;
+ x->x_ctl.c_output = sp[1]->s_vec;
+ dsp_add(lpreson_tilde_perform, 3, x, &x->x_ctl, sp[0]->s_n);
+ return (void *)x;
+}
+
+void *lpreson_tilde_new(t_floatarg f)
+{
+ t_lpreson_tilde *x = (t_lpreson_tilde *)pd_new(lpreson_tilde_class);
+ x->x_order = f >= 1 ? (int)f : 5;
+
+ outlet_new(&x->x_obj, &s_signal);
+ return (void *)x;
+}
+
+void lpreson_tilde_setup(void)
+{
+ lpreson_tilde_class = class_new(gensym("lpreson~"), (t_newmethod)lpreson_tilde_new, 0, sizeof(t_lpreson_tilde), CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post(". . Lattice IIR filter for lpc. . . . . . .");
+ post(". . by Nicolas Chetry <okin@altern.org> . .");
+ post(". & Edward Kelly <morph_2016@yahoo.co.uk> .");
+
+ class_addmethod(lpreson_tilde_class, (t_method)lpreson_tilde_dsp, gensym("dsp"), 0);
+// class_sethelpsymbol(lpreson_tilde_class, gensym("help-lpc~"));
+ class_addlist(lpreson_tilde_class, lpreson_tilde_list);
+ class_sethelpsymbol(lpreson_tilde_class, gensym("lpc-cross-synthesis.pd"));
+ CLASS_MAINSIGNALIN(lpreson_tilde_class, t_lpreson_tilde, f_dummy);
+}
diff --git a/externals/build/src/peakit~.c b/externals/build/src/peakit~.c
new file mode 100644
index 00000000..09cf7879
--- /dev/null
+++ b/externals/build/src/peakit~.c
@@ -0,0 +1,138 @@
+/* peakit~ - find frequencies and magnitudes of FFT peaks
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+#include <math.h>
+#include <string.h>
+
+static t_class *peakit_tilde_class;
+
+typedef struct _bin_store
+{
+ t_atom peaks[2048];
+ t_atom indices[2048];
+ t_atom theta[4096];
+ t_atom t_prev[4096];
+ t_atom t_delta[4096];
+ t_atom peakfreqs[2048];
+ t_float *f_real, *f_imag;
+} t_bin_store;
+
+typedef struct _peakit_tilde
+{
+ t_object x_obj;
+ t_bin_store x_ctl;
+ t_outlet *peaks_list, *mags_list;
+ t_float f_npeaks, f_minmag, f_dummy;
+} t_peakit_tilde;
+
+t_int *peakit_tilde_perform(t_int *w)
+{
+ t_peakit_tilde *x = (t_peakit_tilde *)(w[1]);
+ t_bin_store *store = (t_bin_store *)(w[2]);
+ t_sample *profile = (t_sample *)(w[3]);
+ int n = (int)(w[4]);
+ t_float *real = store->f_real;
+ t_float *imag = store->f_imag;
+ int vector = n;
+ float s_rate = sys_getsr();
+ float bin = s_rate/n;
+ float boff = bin/2;
+ float interp;
+ float minus_two = 0;
+ float minus_one = 0;
+ float alpha = 0;
+ float peakfreq;
+ float theta = 0;
+ float t_prev = 0;
+ float t_delta;
+ float pi=M_PI;
+ float twopi=2*pi;
+ t_int npeaks = 0;
+ int i, ndx;
+
+ /* find peaks in fourier series */
+ for (i = 0; i < n; i++)
+ {
+ alpha = sqrt(real[i] * real[i] + imag[i] * imag[i]);
+ theta = atan2(real[i], imag[i]);
+ t_prev = atom_getfloatarg(i, 16384, store->theta);
+ SETFLOAT (&store->t_prev[i], t_prev);
+ SETFLOAT (&store->theta[i], theta);
+ t_delta = (atom_getfloatarg(i, 16384, store->theta))-(atom_getfloatarg(i, 16384, store->t_prev));
+ SETFLOAT (&store->t_delta[i], t_delta);
+ if (minus_two<minus_one && alpha<minus_one && minus_one>(x->f_minmag/1000))
+ {
+ SETFLOAT (&store->peaks[npeaks],minus_one);
+ SETFLOAT (&store->indices[npeaks],i-1);
+ npeaks++;
+ }
+ minus_two = minus_one;
+ minus_one = alpha;
+ }
+ for (i = 0; i < npeaks; i++)
+ {
+ ndx = atom_getfloatarg(i, 8192, store->indices);
+ t_delta = atom_getfloatarg(ndx, 16384, store->t_delta);
+ theta = atom_getfloatarg(ndx, 8192, store->theta);
+ t_prev = atom_getfloatarg(ndx, 8192, store->t_prev);
+ t_delta = (t_delta < -pi) ? (theta+twopi)-t_prev : (t_delta > pi) ? theta-(t_prev+twopi) : t_delta;
+ // t_delta = (t_delta < -pi) ? (theta+twopi)-t_prev : (t_delta > pi) ? theta-(t_prev+twopi) : t_delta;
+ peakfreq = (ndx * bin + (boff * (t_delta/pi)));
+ SETFLOAT (&store->peakfreqs[i], peakfreq);
+ }
+ outlet_list(x->mags_list, gensym("list"), (npeaks - 1), store->peaks);
+ outlet_list(x->peaks_list, gensym("list"), (npeaks - 1), store->peakfreqs);
+ return(w+5);
+}
+
+void *peakit_tilde_dsp(t_peakit_tilde *x, t_signal **sp)
+{
+ x->x_ctl.f_real = sp[0]->s_vec;
+ x->x_ctl.f_imag = sp[1]->s_vec;
+ dsp_add(peakit_tilde_perform, 4, x, &x->x_ctl, sp[0]->s_vec, sp[0]->s_n);
+ return (void *)x;
+}
+
+void *peakit_tilde_new(t_floatarg f)
+{
+ t_peakit_tilde *x = (t_peakit_tilde *)pd_new(peakit_tilde_class);
+ x->f_minmag = f;
+ memset(x->x_ctl.theta, 0, 8192);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ floatinlet_new(&x->x_obj, &x->f_minmag);
+ x->peaks_list = outlet_new(&x->x_obj, &s_list);
+ x->mags_list = outlet_new(&x->x_obj, &s_list);
+ return (void *)x;
+}
+
+void peakit_tilde_setup(void)
+{
+ peakit_tilde_class = class_new(gensym("peakit~"),
+ (t_newmethod)peakit_tilde_new,
+ 0, sizeof(t_peakit_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|--<>---<>--<peakit~>-<>--<>----<>--|");
+ post("|--<FFT peaks list>-<>---<>--<>-----|");
+ post("|---<>-<frequencies and magnitudes>-|");
+ post("|-<>-<edward>-<kelly>--<>---<2005>--|");
+
+ class_sethelpsymbol(peakit_tilde_class, gensym("help-peakit~"));
+ class_addmethod(peakit_tilde_class, (t_method)peakit_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(peakit_tilde_class, t_peakit_tilde, f_dummy);
+}
diff --git a/externals/build/src/simile.c b/externals/build/src/simile.c
new file mode 100644
index 00000000..24f049bf
--- /dev/null
+++ b/externals/build/src/simile.c
@@ -0,0 +1,69 @@
+/*
+ * simile : windowed similarity comparison
+ * Copyright (C) 2005 edward kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+
+typedef struct _simile {
+ t_object x_obj;
+ t_float x_win;
+ t_float min;
+ t_float sign;
+ t_float x_in1;
+ t_float x_in2;
+ t_float x_result;
+ t_outlet *x_sim, *x_sign;
+} t_simile;
+
+void simile_float(t_simile *x, t_floatarg in1) {
+ x->x_in1 = in1;
+ x->x_win = x->x_win > 0 ? x->x_win : 0.01; /* defaults to 0.01 so that we avoid /0 errors */
+ x->min = ( x->x_in1 > x->x_in2 ) ? (x->x_in1 - x->x_in2) : (x->x_in2 - x->x_in1);
+ x->sign = ( x->x_in1 >= x->x_in2 ) ? 1 : -1;
+ x->x_result = 1 / ((x->min / x->x_win) + 1);
+ outlet_float(x->x_sign, x->sign);
+ outlet_float(x->x_sim, x->x_result);
+}
+
+void simile_bang(t_simile *x) {
+ outlet_float(x->x_sign, x->sign);
+ outlet_float(x->x_sim, x->x_result);
+}
+
+t_class *simile_class;
+
+void *simile_new(t_floatarg x_win) {
+ t_simile *x = (t_simile *)pd_new(simile_class);
+ x->x_sim = outlet_new(&x->x_obj, gensym("float"));
+ x->x_sign = outlet_new(&x->x_obj, gensym("float"));
+ floatinlet_new(&x->x_obj, &x->x_in2);
+ floatinlet_new(&x->x_obj, &x->x_win);
+ return (void *)x;
+}
+
+void simile_setup(void) {
+ simile_class = class_new(gensym("simile"),
+ (t_newmethod)simile_new,
+ 0, sizeof(t_simile),
+ 0, A_DEFFLOAT, 0);
+ post("|------------->simile<--------------|");
+ post("|->weighted similarity measurement<-|");
+ post("|-->edward<----->kelly<----->2005<--|");
+ class_sethelpsymbol(simile_class, gensym("help-simile"));
+ class_addbang(simile_class, simile_bang);
+ class_addfloat(simile_class, simile_float);
+}
diff --git a/externals/build/src/simile~.c b/externals/build/src/simile~.c
new file mode 100644
index 00000000..a6bc5622
--- /dev/null
+++ b/externals/build/src/simile~.c
@@ -0,0 +1,84 @@
+/*
+ * simile~ : windowed similarity comparison for signals
+ * Copyright (C) 2005 edward kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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
+ */
+
+#include "m_pd.h"
+
+static t_class *simile_tilde_class;
+
+typedef struct _simile_tilde {
+ t_object x_obj;
+ t_sample f_win;
+ t_float x_dummy;
+ t_outlet *f_frame;
+} t_simile_tilde;
+
+t_int *simile_tilde_perform(t_int *w) {
+ t_simile_tilde *x = (t_simile_tilde *)(w[1]);
+ t_sample *in1 = (t_sample *)(w[2]);
+ t_sample *in2 = (t_sample *)(w[3]);
+ t_sample *out = (t_sample *)(w[4]);
+ t_sample *sign = (t_sample *)(w[5]);
+ int n = (int)(w[6]);
+
+ t_sample f_win = x->f_win > 0 ? x->f_win : 0.01;
+ t_float f_accum = 0;
+ while (n--) {
+ float i1=(*in1++);
+ float i2=(*in2++);
+ float win = x->f_win > 0 ? x->f_win : 0.001;
+ float min = i1 > i2 ? i1 - i2 : i2 - i1;
+ f_accum += *out++ = 1/((min/win)+1);
+ *sign++ = i1 >= i2 ? 1 : -1;
+ }
+ outlet_float(x->f_frame, f_accum);
+ return (w+7);
+}
+
+void simile_tilde_dsp(t_simile_tilde *x, t_signal **sp) {
+ dsp_add(simile_tilde_perform, 6, x,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n);
+}
+
+void *simile_tilde_new(t_floatarg f) {
+ t_simile_tilde *x = (t_simile_tilde *)pd_new(simile_tilde_class);
+
+ x->f_win = f > 0 ? f : 0.01; /* window defaults to 0.01 if no argument given */
+
+ inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ floatinlet_new (&x->x_obj, &x->f_win);
+ outlet_new(&x->x_obj, &s_signal);
+ outlet_new(&x->x_obj, &s_signal);
+ x->f_frame = outlet_new(&x->x_obj, gensym("float"));
+ return (void *)x;
+}
+
+void simile_tilde_setup(void) {
+ simile_tilde_class = class_new(gensym("simile~"),
+ (t_newmethod)simile_tilde_new,
+ 0, sizeof(t_simile_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|~~~~~~~~~~~~&simile~&~~~~~~~~~~~~~~|");
+ post("|~&weighted similarity measurement&~|");
+ post("|~~&edward&~~~~~&kelly&~~~~~&2005&~~|");
+
+ class_sethelpsymbol(simile_tilde_class, gensym("help-simile~"));
+ class_addmethod(simile_tilde_class,
+ (t_method)simile_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(simile_tilde_class, t_simile_tilde, x_dummy);
+}
diff --git a/externals/build/src/steady.c b/externals/build/src/steady.c
new file mode 100644
index 00000000..c79ac4ef
--- /dev/null
+++ b/externals/build/src/steady.c
@@ -0,0 +1,80 @@
+#include "m_pd.h"
+#include <math.h>
+
+typedef struct _steady
+{
+ t_object x_obj;
+ t_float f_min;
+ t_float f_max;
+ t_float f_prev;
+ t_int resetflag;
+ t_float f_in, f_maxjump;
+ t_outlet *max, *min, *smooth;
+} t_steady;
+
+t_class *steady_class;
+
+void steady_float (t_steady *x, t_floatarg fin)
+{
+ if (x->resetflag == 0)
+ {
+ x->f_max = fin > x->f_max ? fin : x->f_max;
+ x->f_min = fin < x->f_min ? fin : x->f_min;
+ outlet_float(x->smooth, fin);
+ outlet_float(x->min, x->f_min);
+ outlet_float(x->max, x->f_max);
+ x->f_prev = fin;
+ x->resetflag=1;
+ }
+ else
+ {
+ float min = fin >= x->f_prev ? x->f_prev : fin;
+ float max = fin <= x->f_prev ? x->f_prev : fin;
+ fin = (max - min) > x->f_maxjump ? x->f_prev : fin;
+ x->f_max = fin > x->f_max ? fin : x->f_max;
+ x->f_min = fin < x->f_min ? fin : x->f_min;
+ float sm_fin = fabs(fin - x->f_prev) > x->f_maxjump ? x->f_prev : fin;
+ outlet_float(x->smooth, sm_fin);
+ outlet_float(x->min, x->f_min);
+ outlet_float(x->max, x->f_max);
+ x->f_prev = fin;
+ }
+}
+
+void steady_bang (t_steady *x)
+{
+ outlet_float(x->min, x->f_min);
+ outlet_float(x->max, x->f_max);
+ x->f_min = 1e08;
+ x->f_max = -1e08;
+ x->resetflag=0;
+}
+
+void *steady_new(t_floatarg f)
+{
+ t_steady *x = (t_steady *)pd_new(steady_class);
+ x->f_min = 1e08;
+ x->f_max = -1e08;
+ x->f_maxjump = f;
+ x->resetflag = 0;
+ x->f_prev = 0;
+ floatinlet_new(&x->x_obj, &x->f_maxjump);
+ x->max = outlet_new(&x->x_obj, gensym("float"));
+ x->min = outlet_new(&x->x_obj, gensym("float"));
+ x->smooth = outlet_new(&x->x_obj, gensym("float"));
+ return (void *)x;
+}
+
+void steady_setup(void) {
+ steady_class = class_new(gensym("steady"),
+ (t_newmethod)steady_new,
+ 0, sizeof(t_steady),
+ 0, A_DEFFLOAT, 0);
+ post("|+++++++++++++++++>steady<------------------|");
+ post("|+>max, min and through must not jump more<-|");
+ post("|+++++++++>than a specified amount<---------|");
+ post("|+++>edward<------->kelly<++++++++>2005<----|");
+ class_sethelpsymbol(steady_class, gensym("help-steady"));
+ class_addbang(steady_class, steady_bang);
+ class_addfloat(steady_class, steady_float);
+}
diff --git a/externals/build/src/voicing_detector~.c b/externals/build/src/voicing_detector~.c
new file mode 100644
index 00000000..5ed5a3d0
--- /dev/null
+++ b/externals/build/src/voicing_detector~.c
@@ -0,0 +1,131 @@
+#include "m_pd.h"
+#include <math.h>
+
+static t_class *voicing_detector_tilde_class;
+
+typedef struct _voicing_control
+{
+ t_float *c_input;
+ t_float f_sum_abs;
+ t_atom otemp[4096];
+ t_int method;
+} t_voicing_control;
+
+typedef struct _voicing_detector_tilde
+{
+ t_object x_obj;
+ t_float f_dummy, f_thresh, f_low, f_high;
+ t_voicing_control x_ctl;
+ t_outlet *voiced, *prob;
+} t_voicing_detector_tilde;
+
+static t_int *voicing_detector_tilde_perform(t_int *w)
+{
+ t_voicing_detector_tilde *x = (t_voicing_detector_tilde *)(w[1]);
+ t_voicing_control *ctl = (t_voicing_control *)(w[2]);
+ t_int n = (int)(w[3]);
+ t_float *in = ctl->c_input;
+ if (x->f_high < x->f_low)
+ {
+ float tmp = x->f_low;
+ x->f_low = x->f_high;
+ x->f_high = tmp;
+ }
+ t_float current, previous, next, temp0, avg, max, peak0;
+ current = previous = next = temp0 = avg = max = peak0 = 0;
+ t_float min = 1000;
+ t_float samplerate = sys_getsr();
+ t_float start = samplerate / x->f_high;
+ start = start > 1 ? start : 1;
+ t_float end = samplerate / x->f_low;
+ end = end < (n-1) ? end : n-1;
+ t_float result, prob, diff, diff2;
+ t_int i = 0;
+ int j;
+ int l = n;
+ int maxp = 0;
+ int maxi = 0;
+ float temp[n];
+ ctl->f_sum_abs = 0.0;
+ for (i=0;i<l;i++)
+ {
+ ctl->f_sum_abs += fabs(in[i]); /* I have to calculate f_sum_abs for the whole block before I can calculate amdf */
+ temp[i] = 0.0;
+ SETFLOAT(&ctl->otemp[i], 0.0);
+ }
+ for (i=1;i<l;i++)
+ {
+ for (j=start;j<=end;j++) /* the Average Magnitude Difference Function */
+ {
+ temp[j] = i + j < l ? in[i+j] : 0.0;
+ temp0 = atom_getfloatarg(i, 4096, ctl->otemp);
+ temp0 += i == 0 ? 0.0 : fabs(in[j] - temp[j]);
+ }
+ temp0 += ((float)i / (float)l) * ctl->f_sum_abs;
+ SETFLOAT(&ctl->otemp[i], temp0);
+ }
+
+ for (i=start+1;i<end;i++)
+ {
+ previous= atom_getfloatarg(i-1, 2048, ctl->otemp);
+ current = atom_getfloatarg(i, 2048, ctl->otemp);
+ next = atom_getfloatarg(i+1, 2048, ctl->otemp);
+ max = current > max ? current : max;
+ min = current < min ? current : min;
+ avg += current;
+ }
+ avg = avg / (end-start);
+ diff = avg - min;
+ diff2 = max - min;
+ result = ctl->method == 0 ? ((avg - min) > (x->f_thresh) ? 1 : 0) : ((max - min) > x->f_thresh ? 1 : 0);
+ prob = diff2 / max;
+ outlet_float(x->prob, prob);
+ outlet_float(x->voiced, result);
+ return(w+4);
+}
+
+void voicing_detector_tilde_bound(t_voicing_detector_tilde *x, t_floatarg f1, t_floatarg f2)
+{
+ x->f_low = f1;
+ x->f_high = f2;
+}
+
+void voicing_detector_tilde_method(t_voicing_detector_tilde *x, t_floatarg f)
+{
+ x->x_ctl.method = f > 0 ? 1 : 0;
+}
+
+void *voicing_detector_tilde_dsp(t_voicing_detector_tilde *x, t_signal **sp)
+{
+ x->x_ctl.c_input = sp[0]->s_vec;
+ dsp_add(voicing_detector_tilde_perform, 3, x, &x->x_ctl, sp[0]->s_n);
+ return (void *)x;
+}
+
+void *voicing_detector_tilde_new(t_floatarg f)
+{
+ t_voicing_detector_tilde *x = (t_voicing_detector_tilde *)pd_new(voicing_detector_tilde_class);
+ x->f_thresh = f < 0 ? f : 25;
+ x->f_low = 60;
+ x->f_high = 500;
+
+ floatinlet_new (&x->x_obj, &x->f_thresh);
+ x->voiced = outlet_new(&x->x_obj, gensym("float"));
+ x->prob = outlet_new(&x->x_obj, gensym("float"));
+ return (void *)x;
+}
+
+void voicing_detector_tilde_setup(void)
+{
+ voicing_detector_tilde_class = class_new(gensym("voicing_detector~"), (t_newmethod)voicing_detector_tilde_new, 0, sizeof(t_voicing_detector_tilde), CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("\n-->AMDF voicing detector v0.2");
+ post("-->by Nicolas Chetry <okin@altern.org>");
+ post("-->& Edward Kelly <morph_2016@yahoo.co.uk>");
+
+ class_addmethod(voicing_detector_tilde_class, (t_method)voicing_detector_tilde_bound, gensym("bound"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(voicing_detector_tilde_class, (t_method)voicing_detector_tilde_method, gensym("method"), A_DEFFLOAT, 0);
+ class_addmethod(voicing_detector_tilde_class, (t_method)voicing_detector_tilde_dsp, gensym("dsp"), 0);
+ class_sethelpsymbol(voicing_detector_tilde_class, gensym("help-voicing_detector~"));
+ CLASS_MAINSIGNALIN(voicing_detector_tilde_class, t_voicing_detector_tilde, f_dummy);
+}
diff --git a/externals/build/src/zeroxpos~.c b/externals/build/src/zeroxpos~.c
new file mode 100644
index 00000000..1c436085
--- /dev/null
+++ b/externals/build/src/zeroxpos~.c
@@ -0,0 +1,101 @@
+#include "m_pd.h"
+
+static t_class *zeroxpos_tilde_class;
+
+typedef struct _zeroxpos_control
+{
+ t_float *c_input;
+ t_int final_pol;
+} t_zeroxpos_control;
+
+typedef struct _zeroxpos_tilde
+{
+ t_object x_obj;
+ t_zeroxpos_control x_ctl;
+ t_float f_num, f_dummy;
+ t_int i_bang, i_pol, i_count, i_ndx;
+ t_outlet *f_pos, *f_pol;
+} t_zeroxpos_tilde;
+
+t_int *zeroxpos_tilde_perform(t_int *w)
+{
+ t_zeroxpos_tilde *x = (t_zeroxpos_tilde *)(w[1]);
+ t_zeroxpos_control *ctl = (t_zeroxpos_control *)(w[2]);
+ int n = (int)(w[3]);
+ t_float *in = ctl->c_input;
+ int number = (int)x->f_num;
+ int count = x->i_count;
+ int polarity = 1;
+ int i = 0;
+ x->i_pol = 0;
+ x->i_ndx = -1;
+ int prev = ctl->final_pol;
+
+ for(i=0;i<n;i++)
+ {
+ polarity = in[i] >= 0 ? 1 : -1;
+ if((polarity < prev || polarity > prev) && count == number && x->i_bang == 1)
+ {
+ x->i_ndx = i;
+ x->i_pol = polarity;
+ count++;
+ x->i_bang = 0;
+ }
+ if((polarity < prev || polarity > prev) && count < number)
+ {
+ count++;
+ }
+ if(i==n-1)
+ {
+ ctl->final_pol = polarity;
+ x->i_count = count;
+ }
+ prev = polarity;
+ }
+ outlet_float(x->f_pol, (float)x->i_pol);
+ outlet_float(x->f_pos, (float)x->i_ndx);
+ return(w+4);
+}
+
+void zeroxpos_tilde_bang(t_zeroxpos_tilde *x)
+{
+ x->i_bang = 1;
+ x->i_count = 0;
+}
+
+void *zeroxpos_tilde_dsp(t_zeroxpos_tilde *x, t_signal **sp)
+{
+ x->x_ctl.c_input = sp[0]->s_vec;
+ dsp_add(zeroxpos_tilde_perform, 3, x, &x->x_ctl, sp[0]->s_n);
+ return (void *)x;
+}
+
+void *zeroxpos_tilde_new(t_floatarg f)
+{
+ t_zeroxpos_tilde *x = (t_zeroxpos_tilde *)pd_new(zeroxpos_tilde_class);
+ x->f_num = f > 0 ? f : 1;
+ x->x_ctl.final_pol = 1;
+ x->i_count = 0;
+ floatinlet_new (&x->x_obj, &x->f_num);
+ x->f_pos = outlet_new(&x->x_obj, gensym("float"));
+ x->f_pol = outlet_new(&x->x_obj, gensym("float"));
+ return (void *)x;
+}
+
+void zeroxpos_tilde_setup(void)
+{
+ zeroxpos_tilde_class = class_new(gensym("zeroxpos~"),
+ (t_newmethod)zeroxpos_tilde_new,
+ 0, sizeof(t_zeroxpos_tilde),
+ CLASS_DEFAULT, A_DEFFLOAT, 0);
+
+ post("|¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬zeroxpos~``````````````````````|");
+ post("|find 1st, 2nd or 3rd etc zero crossing point in frame|");
+ post("|````edward¬¬¬¬¬¬¬¬¬¬¬¬kelly``````````````````2005¬¬¬¬|");
+
+ class_sethelpsymbol(zeroxpos_tilde_class, gensym("help-zeroxpos~"));
+ class_addbang(zeroxpos_tilde_class, zeroxpos_tilde_bang);
+ class_addmethod(zeroxpos_tilde_class, (t_method)zeroxpos_tilde_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(zeroxpos_tilde_class, t_zeroxpos_tilde, f_dummy);
+}
+