aboutsummaryrefslogtreecommitdiff
path: root/examples/puredata/xtract~.c
diff options
context:
space:
mode:
authorJamie Bullock <jamie@postlude.co.uk>2006-12-12 21:47:42 +0000
committerJamie Bullock <jamie@postlude.co.uk>2006-12-12 21:47:42 +0000
commit251e328008d541478aba71c46a7444ee2283bcbf (patch)
tree6d926f473dfa0fb9cfd273d3c986e535029a1c60 /examples/puredata/xtract~.c
parentbff72881ced8120c84c3d70e1ffeaa6af5f741d0 (diff)
downloadLibXtract-251e328008d541478aba71c46a7444ee2283bcbf.tar.gz
LibXtract-251e328008d541478aba71c46a7444ee2283bcbf.tar.bz2
LibXtract-251e328008d541478aba71c46a7444ee2283bcbf.zip
Numerous fixes, see ChangeLog
Diffstat (limited to 'examples/puredata/xtract~.c')
-rw-r--r--examples/puredata/xtract~.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/puredata/xtract~.c b/examples/puredata/xtract~.c
index 575a170..77945f8 100644
--- a/examples/puredata/xtract~.c
+++ b/examples/puredata/xtract~.c
@@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/* calculates the spectral xtract of one frame, given peak frequency and amplitude to first and second inputs respectively */
#include "m_pd.h"
+#include <math.h>
#define XTRACT
#include "xtract/libxtract.h"
@@ -53,6 +54,9 @@ static t_int *xtract_perform(t_int *w) {
if(return_code == FEATURE_NOT_IMPLEMENTED)
pd_error(x, "Feature not implemented");
+
+ /* set nan, inf or -inf to 0 */
+ result = (isinf(result) || isnan(result) ? 0 : result);
outlet_float(x->x_obj.ob_outlet, result);
return (w+4);
@@ -166,6 +170,7 @@ static void *xtract_new(t_symbol *me, t_int argc, t_atom *argv) {
case INHARMONICITY:
case LOWEST_MATCH:
case F0:
+ case TONALITY:
floatargs = 1;
break;
case SKEWNESS:
@@ -185,7 +190,6 @@ static void *xtract_new(t_symbol *me, t_int argc, t_atom *argv) {
case ZCR:
case LOUDNESS:
case FLATNESS:
- case TONALITY:
case CREST:
case NOISINESS:
case RMS_AMPLITUDE:
@@ -218,7 +222,7 @@ static void *xtract_new(t_symbol *me, t_int argc, t_atom *argv) {
x->argv = (xtract_mel_filter *)getbytes(x->memory.argv);
}
else if(x->feature == BARK_COEFFICIENTS){
- x->memory.argv = (size_t)(sizeof(BARK_BANDS * sizeof(t_int)));
+ x->memory.argv = (size_t)(BARK_BANDS * sizeof(t_int));
x->argv = (t_int *)getbytes(x->memory.argv);
}
else if (floatargs){