diff options
author | Jamie Bullock <jamie@jamiebullock.com> | 2014-11-08 00:07:02 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@jamiebullock.com> | 2014-11-08 00:07:02 +0000 |
commit | ba706261d3fc5b436aa6f09d57e62eeb77377d8f (patch) | |
tree | 4faadd5931a89a847ae9bb2345d9fe7bb0e2f778 /examples/MSP | |
parent | 89890e226e5da72743f885cefb5273c51baf094e (diff) | |
parent | 89a9ec7a352dc35141b8f9a87c202fdd448e9a6f (diff) | |
download | LibXtract-ba706261d3fc5b436aa6f09d57e62eeb77377d8f.tar.gz LibXtract-ba706261d3fc5b436aa6f09d57e62eeb77377d8f.tar.bz2 LibXtract-ba706261d3fc5b436aa6f09d57e62eeb77377d8f.zip |
Merge branch 'feature/no-autotools' into develop
Diffstat (limited to 'examples/MSP')
-rw-r--r-- | examples/MSP/Info.plist | 24 | ||||
-rw-r--r-- | examples/MSP/Makefile | 59 | ||||
-rw-r--r-- | examples/MSP/PkgInfo | 1 | ||||
-rw-r--r-- | examples/MSP/test/magspec | 1 | ||||
-rw-r--r-- | examples/MSP/test/xtract-test.pat | 1 | ||||
-rw-r--r-- | examples/MSP/version.plist | 16 | ||||
-rw-r--r-- | examples/MSP/xtract~.c | 337 |
7 files changed, 0 insertions, 439 deletions
diff --git a/examples/MSP/Info.plist b/examples/MSP/Info.plist deleted file mode 100644 index 9a02ed6..0000000 --- a/examples/MSP/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>xtract~</string> - <key>CFBundleIconFile</key> - <string></string> - <key>CFBundleIdentifier</key> - <string>co.uk.postlude</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>iLaX</string> - <key>CFBundleSignature</key> - <string>max2</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>CSResourcesFileMapped</key> - <true/> -</dict> -</plist> diff --git a/examples/MSP/Makefile b/examples/MSP/Makefile deleted file mode 100644 index bb3fbb4..0000000 --- a/examples/MSP/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -NAME=xtract~
-CSYM=xtract~
-
-all: universal
-current: universal
-
-FRAMEWORKS = /Library/Frameworks
-MAXINCLUDE = $(FRAMEWORKS)/MaxAPI.framework/Headers
-MSPINCLUDE = $(FRAMEWORKS)/MaxAudioAPI.framework/Headers
-INSTALLDIR = /Applications/Max5/Cycling\ \'74/externals/
-XTRACT_HEADERS = /usr/local/include
-
-LIPO = /usr/bin/lipo
-CC = gcc
-
-#DEBUG_FLAGS = -Werror -Wall
-
-CFLAGS = -F$(FRAMEWORKS) -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -x c -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -fmessage-length=0 -I$(MAXINCLUDE) -I$(MSPINCLUDE) $(DEBUG_FLAGS) -I$(XTRACT_HEADERS)
-
-I386CFLAGS = -arch i386
-IX86_64CFLAGS = -arch x86_64
-
-LDFLAGS = -F$(FRAMEWORKS) -L$(MAXINCLUDE) -L$(MSPINCLUDE) -framework Carbon -framework MaxAPI -framework MaxAudioAPI -Wl,-Y,1455 -bundle -L/usr/local/lib -lxtract
-
-I386LDFLAGS = -arch i386
-IX86_64CFLAGS = -arch x86_64
-
-universal:
- $(CC) $(CFLAGS) $(I386CFLAGS) -o $(NAME)-i386.o -c $(NAME).c
- $(CC) $(LDFLAGS) $(I386LDFLAGS) -o $(NAME)-i386 $(NAME)-i386.o
- $(LIPO) -create $(NAME)-i386 -output $(NAME)
- mkdir -p $(NAME).mxo/Contents/MacOS
- cp Info.plist PkgInfo $(NAME).mxo/Contents/
- cp $(NAME) $(NAME).mxo/Contents/MacOS
-
-
-intel:
- $(CC) $(CFLAGS) $(I386CFLAGS) -o $(NAME)-i386.o -c $(NAME).c
- $(CC) $(LDFLAGS) $(I386LDFLAGS) -o $(NAME)-i386 $(NAME)-i386.o
- $(LIPO) -create $(NAME)-i386 -output $(NAME)
- mkdir -p $(NAME).mxo/Contents/MacOS
- cp Info.plist PkgInfo $(NAME).mxo/Contents/
- cp $(NAME) $(NAME).mxo/Contents/MacOS
-
-intel64:
- $(CC) $(CFLAGS) $(IX86_64CFLAGS) -o $(NAME)-64.o -c $(NAME).c
- $(CC) $(LDFLAGS) $(IX86_64LDFLAGS) -o $(NAME)-64 $(NAME)-64.o
- $(LIPO) -create $(NAME)-64 -output $(NAME)
- mkdir -p $(NAME).mxo/Contents/MacOS
- cp Info.plist PkgInfo $(NAME).mxo/Contents/
- cp $(NAME) $(NAME).mxo/Contents/MacOS
-
-
-
-clean:
- rm -rf *64* *i386* xtract~ *.mxo
-
-install:
- $(INSTALL) cp -r $(NAME).mxo $(INSTALLDIR)
diff --git a/examples/MSP/PkgInfo b/examples/MSP/PkgInfo deleted file mode 100644 index 0febb6e..0000000 --- a/examples/MSP/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -iLaXmax2
\ No newline at end of file diff --git a/examples/MSP/test/magspec b/examples/MSP/test/magspec deleted file mode 100644 index 14904f6..0000000 --- a/examples/MSP/test/magspec +++ /dev/null @@ -1 +0,0 @@ -max v2;
#N vpatcher 762 88 1362 488;
#P window setfont "Sans Serif" 9.;
#N out 1;
#P newobj 219 220 33 196617 out 1;
#N in 2;
#P newobj 316 36 25 196617 in 2;
#N in 1;
#P newobj 218 44 25 196617 in 1;
#P newex 218 112 108 196617 wave~ mags 0. 11.61;
#P newex 218 77 101 196617 phasor~ 86.133003;
#P newex 53 119 100 196617 buffer~ mags 11.62;
#P newex 218 146 134 196617 xtract~ irregularity_k 512;
#P connect 4 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 0 0;
#P connect 0 0 6 0;
#P connect 5 0 3 2;
#P pop;
\ No newline at end of file diff --git a/examples/MSP/test/xtract-test.pat b/examples/MSP/test/xtract-test.pat deleted file mode 100644 index 72394bf..0000000 --- a/examples/MSP/test/xtract-test.pat +++ /dev/null @@ -1 +0,0 @@ -max v2;
#N vpatcher 22 65 823 798;
#P origin -203 -11;
#P window setfont "Sans Serif" 9.;
#P newex 154 177 46 196617 / 1000.;
#P newex 19 349 39 196617 noise~;
#P flonum 79 206 88 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 79 180 71 196617 expr log($f1);
#P message 377 385 68 196617 /braun/5 \$1;
#P message 305 385 68 196617 /braun/4 \$1;
#P message 229 385 68 196617 /braun/3 \$1;
#P message 155 386 68 196617 /braun/2 \$1;
#P flonum 657 181 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 511 176 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 426 179 66 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 334 180 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 594 180 55 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 0 378 69 196617 send~ source;
#P newex 425 150 72 196617 r irregularity;
#P newex 508 151 72 196617 r fundamental;
#P newex 656 151 57 196617 r variance;
#P newex 223 151 104 196617 r standard_deviation;
#P newex 593 150 55 196617 r centroid;
#P newex 79 148 55 196617 r kurtosis;
#P newex 332 151 80 196617 r inharmonicity;
#P newex 154 151 61 196617 r skewness;
#N vpatcher 9 59 787 818;
#P window setfont "Sans Serif" 9.;
#P newex 622 460 37 196617 pack f;
#P window linecount 1;
#P newex 213 260 83 196617 receive~ source;
#P newex 213 290 35 196617 *~ 1.;
#P newex 516 261 72 196617 s irregularity;
#P newex 226 390 72 196617 s fundamental;
#P newex 557 514 57 196617 s variance;
#P newex 364 560 104 196617 s standard_deviation;
#P newex 312 444 55 196617 s centroid;
#P newex 183 688 55 196617 s kurtosis;
#P newex 70 468 80 196617 s inharmonicity;
#P newex 7 689 61 196617 s skewness;
#P newex 71 423 95 196617 receive~ spectrum;
#P message 213 426 40 196617 list \$1;
#P newex 70 445 153 196617 xtract~ spectral_inharmonicity;
#P newex 529 403 62 196617 poke~ mags;
#P newex 436 265 27 196617 / 2.;
#P newex 470 207 29 196617 * 2.;
#P newex 555 378 85 196617 count~ 0 1024 1;
#P newex 470 232 111 196617 poly~ magspec vs 512;
#P newex 7 667 134 196617 xtract~ spectral_skewness;
#P newex 7 644 95 196617 receive~ spectrum;
#P newex 408 337 44 196617 pack f f;
#P newex 183 667 128 196617 xtract~ spectral_kurtosis;
#P newex 183 644 95 196617 receive~ spectrum;
#P newex 301 559 44 196617 pack f f;
#P newex 333 513 95 196617 receive~ spectrum;
#P message 502 514 40 196617 list \$1;
#P newex 335 533 177 196617 xtract~ spectral_standard_deviation;
#P newex 502 467 95 196617 receive~ spectrum;
#P newex 442 403 81 196617 send~ spectrum;
#P newex 502 488 130 196617 xtract~ spectral_variance;
#P newex 213 360 58 196617 xtract~ f0;
#P newex 394 234 47 196617 * 1000.;
#P newex 394 212 31 196617 !/ 0.;
#P newex 324 80 27 196617 i 10;
#P newex 304 57 30 196617 t b b;
#P newex 304 35 48 196617 loadbang;
#P newex 318 169 27 196617 / 0.;
#P newex 301 326 27 196617 *~;
#P newex 318 274 46 196617 phasor~;
#P newex 318 298 87 196617 wave~ hann 0. 0.;
#P newex 304 130 54 196617 dspstate~;
#P newex 324 103 73 196617 adstatus sigvs;
#B color 5;
#P newex 301 405 128 196617 xtract~ spectral_centroid;
#P newex 301 360 117 196617 xtract~ spectrum 1024;
#P comment 406 300 109 196617 //windowing function;
#P window linecount 0;
#P comment 46 52 100 196617 //basic feature cascade;
#P comment 596 233 100 196617 //poly~ used to reduce down to half-block size to get just magnitudes;
#P comment 598 406 140 196617 //mags is inside the poly~;
#P connect 28 0 29 0;
#P connect 29 0 38 0;
#P connect 37 0 35 0;
#P connect 35 0 39 0;
#P connect 24 0 29 1;
#P connect 25 0 26 0;
#P connect 26 0 40 0;
#P connect 47 0 46 0;
#P connect 46 0 17 0;
#P connect 17 0 36 0;
#P connect 36 0 35 1;
#P connect 17 0 44 0;
#P connect 46 0 10 0;
#P connect 10 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 24 0;
#P connect 24 0 26 1;
#P connect 12 0 13 0;
#P connect 13 0 7 0;
#P connect 5 0 41 0;
#P connect 7 1 11 0;
#P connect 11 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 10 1;
#P connect 13 1 14 0;
#P connect 14 0 6 0;
#P connect 7 3 11 1;
#P connect 23 0 21 0;
#P connect 21 0 24 1;
#P connect 21 0 42 0;
#P connect 7 1 15 0;
#P connect 15 0 16 0;
#P connect 16 0 8 2;
#P connect 11 0 27 0;
#P connect 27 0 4 1;
#P connect 7 3 15 1;
#P connect 16 0 33 0;
#P connect 4 0 19 0;
#P connect 11 0 32 0;
#P connect 32 0 30 0;
#P connect 20 0 18 0;
#P connect 18 0 22 0;
#P connect 22 0 21 1;
#P connect 30 0 45 0;
#P connect 4 0 34 0;
#P connect 31 0 34 1;
#P connect 18 0 43 0;
#P connect 33 0 30 1;
#P connect 5 0 48 0;
#P connect 48 0 18 1;
#P pop;
#P newobj 594 83 37 196617 p guts;
#P newex 0 269 38 196617 * 100;
#P slider 0 116 15 128 0 1;
#P number 0 294 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 79 386 68 196617 /braun/1 \$1;
#P newex 79 476 120 196617 udpsend 127.0.0.1 4444;
#N vpatcher 10 59 364 406;
#P window setfont "Sans Serif" 9.;
#P newex 47 33 48 196617 loadbang;
#P window linecount 1;
#P newex 87 102 27 196617 t i i;
#P newex 87 258 43 196617 pack i f;
#P newex 87 80 27 196617 - 1;
#P newex 47 59 51 196617 Uzi 1024;
#P newex 87 283 59 196617 peek~ hann;
#P newex 120 227 38 196617 + 0.5;
#P newex 120 206 42 196617 * -0.5;
#P newex 104 126 46 196617 / 1023.;
#P newex 120 161 47 196617 * 6.283;
#P newex 120 183 23 196617 cos;
#P window linecount 0;
#P comment 182 38 100 196617 //makes a hanning window in a buffer called hann;
#P connect 11 0 7 0;
#P connect 7 2 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 6 0;
#P connect 10 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 9 1;
#P pop;
#P newobj 550 35 80 196617 p make_hanning;
#P newex 533 57 97 196617 buffer~ hann 23.22;
#P user ezdac~ 648 37 692 70 0;
#P newex 0 321 55 196617 saw~ 440;
#P connect 7 0 8 0;
#P connect 8 0 6 0;
#P connect 6 0 0 0;
#P connect 0 0 18 0;
#P connect 30 0 18 0;
#P connect 12 0 28 0;
#P connect 28 0 29 0;
#P connect 28 0 5 0;
#P connect 27 0 4 0;
#P connect 26 0 4 0;
#P connect 25 0 4 0;
#P connect 24 0 4 0;
#P connect 5 0 4 0;
#P connect 10 0 31 0;
#P connect 11 0 24 0;
#P connect 17 0 25 0;
#P connect 16 0 26 0;
#P connect 11 0 20 0;
#P connect 13 0 27 0;
#P connect 17 0 21 0;
#P connect 16 0 22 0;
#P connect 13 0 19 0;
#P connect 15 0 23 0;
#P pop;
\ No newline at end of file diff --git a/examples/MSP/version.plist b/examples/MSP/version.plist deleted file mode 100644 index 169b5fa..0000000 --- a/examples/MSP/version.plist +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>38</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>ProjectName</key> - <string>CarbonProjectTemplates</string> - <key>SourceVersion</key> - <string>140000</string> -</dict> -</plist> diff --git a/examples/MSP/xtract~.c b/examples/MSP/xtract~.c deleted file mode 100644 index e46ec6a..0000000 --- a/examples/MSP/xtract~.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (C) 2012 Jamie Bullock - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ - -/* calculates the spectral xtract of one frame, given peak frequency and amplitude to first and second inputs respectively */ - -#include "ext.h" -#include "z_dsp.h" -#include <math.h> -#include <string.h> - -#include "xtract/libxtract.h" - -#define BLOCKSIZE 1024 /* FIX: this should be dynamic - somehow */ -#define NYQUIST 22050.0f - -void *xtract_tilde_class; - -/* Struct for keeping track of memory allocations */ -typedef struct _tracked_memory { - char argv; -} tracked_memory; - -typedef struct _xtract { - t_pxobject x_obj; - void *outlet; /*Float outlet */ - t_float f; - t_int feature; - t_symbol *feature_name; - t_int init_blocksize; - t_int done_init; - t_int feature_type; - tracked_memory memory; - void *argv; - double *data; - double *result; -} t_xtract_tilde; - -static t_int *xtract_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_xtract_tilde *x = (t_xtract_tilde *)(w[2]); - t_int N = (t_int)(w[3]); - t_int return_code = 0; - double result = 0.f; - - for(n = 0; n < N; ++n){ - x->data[n] = (double)in[n]; - } - - return_code = xtract[x->feature](x->data, N, x->argv, &result); - - if(return_code == XTRACT_FEATURE_NOT_IMPLEMENTED) - perror("Feature not implemented"); - - /* set nan, inf or -inf to 0 */ - result = (isinf(result) || isnan(result) ? 0 : result); - - outlet_float(x->outlet, (float)result); - return (w+4); -} - -static t_int *xtract_perform_vector(t_int *w) { - t_sample *in = (t_float *)(w[1]); - t_sample *out = (t_float *)(w[2]); - t_xtract_tilde *x = (t_xtract_tilde *)(w[3]); - t_int N = (t_int)(w[4]), n; - t_int return_code = 0; - - if(x->feature == XTRACT_PEAK_SPECTRUM) - N >>= 1; - - if(N != x->init_blocksize && x->done_init){ - post("xtract~ %s: Blocksize mismatch, try specifying the blocksize as a second argument", x->feature_name->s_name); - return (w+5); - } - - for(n = 0; n < N; ++n){ - x->data[n] = (double)in[n]; - } - - return_code = xtract[x->feature](x->data, N, x->argv, x->result); - - for(n = 0; n < N; ++n){ - out[n] = (float)x->result[n]; - } - - if(return_code == XTRACT_FEATURE_NOT_IMPLEMENTED) - perror("Feature not implemented"); - - return (w+5); -} - -static void xtract_tilde_dsp(t_xtract_tilde *x, t_signal **sp) { - - if(x->feature_type == XTRACT_VECTOR) - dsp_add(xtract_perform_vector, 4, - sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n); - - else dsp_add(xtract_perform, 3, sp[0]->s_vec, x, sp[0]->s_n); - -} - -static void *xtract_tilde_new(t_symbol *me, t_int argc, t_atom *argv) { - - t_symbol *tmp; - t_xtract_tilde *x = (t_xtract_tilde *)newobject(xtract_tilde_class); - xtract_mel_filter *mf; - t_int n, N, f, F, n_args, type; - t_float *argv_max; - xtract_function_descriptor_t *fd; - char *p_name, *p_desc, *author; - int year; - - tmp = NULL; - p_name = p_desc = author = NULL; - - n_args = type = x->feature = 0; - - f = F = XTRACT_FEATURES; - - N = BLOCKSIZE; - - x->argv = NULL; - x->done_init = 0; - - x->data = (double *)getbytes(N * sizeof(double)); - x->result = (double *)getbytes(N * sizeof(double)); - - - if(argc) - tmp = argv[0].a_w.w_sym; /*atom_getsymbol(argv); */ - if(argc > 1) - N = (t_int)argv[1].a_w.w_long; - - x->init_blocksize = N; - - /* get function descriptors */ - fd = (xtract_function_descriptor_t *)xtract_make_descriptors(); - - /* iterate over descriptors */ - while(f--){ - /* map creation arg to feature */ - if(tmp == gensym(fd[f].algo.name)){ - x->feature = f; - break; - } - } - - /* allocate memory for feature arguments */ - n_args = fd[f].argc; - type = fd[f].argv.type; - - if(n_args){ - for(n = 0; n < n_args; n++){ - argv_max = &fd[f].argv.max[n]; - //post("Argument %d, max: %.2f", n, *argv_max); - } - if(type == XTRACT_MEL_FILTER){ - x->memory.argv = (size_t)(n_args * sizeof(xtract_mel_filter)); - x->argv = (xtract_mel_filter *)getbytes(x->memory.argv); - } - else if(type == XTRACT_INT){ - x->memory.argv = (size_t)(n_args * sizeof(t_int)); - x->argv = (t_int *)getbytes(x->memory.argv); - } - else if (type == XTRACT_FLOAT){ - x->memory.argv = (size_t)(n_args * sizeof(t_float)); - x->argv = (t_float *)getbytes(x->memory.argv); - } - else - x->memory.argv = 0; - } - - - p_name = fd[f].algo.p_name; - p_desc = fd[f].algo.p_desc; - author = fd[f].algo.author; - year = fd[f].algo.year; - - if(argc){ - if(strcmp(p_name, "")) - post("xtract~: %s", p_name ); - if(strcmp(p_desc, "")) - post("xtract~: %s", p_desc ); - if(strcmp(author, "") && year) - post("xtract~: %s(%d)", author, year); - } - else - post("xtract~: No arguments given"); - - /* do init if needed */ - if(x->feature == XTRACT_MFCC){ - - mf = x->argv; - - mf->n_filters = 20; - - post("xtract~: mfcc: filters = %d", - ((xtract_mel_filter *)x->argv)->n_filters); - mf->filters = - (t_float **)getbytes(mf->n_filters * sizeof(t_float *)); - for(n = 0; n < mf->n_filters; n++) - mf->filters[n] = (float *)getbytes(N * sizeof(float)); - - xtract_init_mfcc(N, NYQUIST, XTRACT_EQUAL_GAIN, 80.0f, - 18000.0f, mf->n_filters, mf->filters); - } - else if(x->feature == XTRACT_BARK_COEFFICIENTS) - xtract_init_bark(N, NYQUIST, x->argv); - - /* Initialise fft_plan if required */ - if(x->feature == XTRACT_AUTOCORRELATION_FFT || - x->feature == XTRACT_SPECTRUM || - x->feature == XTRACT_DCT){ - xtract_init_fft(N, x->feature); - x->done_init = 1; - } - - if(x->feature == XTRACT_AUTOCORRELATION || - x->feature == XTRACT_AUTOCORRELATION_FFT || - x->feature == XTRACT_MFCC || x->feature == XTRACT_AMDF || - x->feature == XTRACT_ASDF|| x->feature == XTRACT_DCT || - x->feature == XTRACT_BARK_COEFFICIENTS || - x->feature == XTRACT_SPECTRUM || - x->feature == XTRACT_PEAK_SPECTRUM || - x->feature == XTRACT_HARMONIC_SPECTRUM) - x->feature_type = XTRACT_VECTOR; - - else if (x->feature == XTRACT_FLUX || x->feature == XTRACT_ATTACK_TIME || - x->feature == XTRACT_DECAY_TIME || x->feature == XTRACT_DELTA) - x->feature_type = XTRACT_DELTA; - - else x->feature_type = XTRACT_SCALAR; - - /* argv through right inlet */ - inlet_new((t_pxobject *)x, "list"); - - /* DSP inlet */ - dsp_setup((t_pxobject *)x, 1); - - - /* if feature is vector, create signal out */ - if(x->feature_type == XTRACT_VECTOR) - outlet_new((t_pxobject *)x, "signal"); - - /* otherwise: float */ - else - x->outlet = floatout((t_pxobject *)x); - - - /* free the function descriptors */ - xtract_free_descriptors(fd); - - return (void *)x; -} - -static void xtract_tilde_get_args(t_xtract_tilde *x, t_symbol *selector, -t_int argc, t_atom *argv) { -/* - if(argc > (t_int)sizeof(x->argv) / - (t_int)sizeof(t_float) || x->argv == NULL) - post("Too many parameters to right inlet"); - else{*/ - - t_float temp = 0.f; - x->argv = getbytes(argc * sizeof(float)); - - while(argc--){ - temp = argv[argc].a_w.w_float; - ((t_float *)x->argv)[argc] = temp; - } - /* }*/ -} - -static void xtract_tilde_show_help(t_xtract_tilde *x, t_symbol *s){ - - int i; - - i = XTRACT_FEATURES; - xtract_function_descriptor_t *fd, *d; - - fd = (xtract_function_descriptor_t *)xtract_make_descriptors(); - post("\nxtract~: Feature List\n"); - - while(i--){ - d = &fd[i]; - post("\t%s", d->algo.name); - } - - xtract_free_descriptors(fd); -} - -static void xtract_tilde_free(t_xtract_tilde *x) { - - if(x->argv != NULL && x->memory.argv) - freebytes(x->argv, x->memory.argv); - freebytes(x->data); - freebytes(x->result); -} - -int main(void) { - - setup((t_messlist **)&xtract_tilde_class, - (method)xtract_tilde_new, - (method)xtract_tilde_free, - sizeof(t_xtract_tilde), - 0L, - A_GIMME, 0); - - addmess((method)xtract_tilde_dsp, "dsp", A_CANT, 0); - addmess((method)xtract_tilde_get_args, "list", A_GIMME, 0); - addmess((method)xtract_tilde_show_help, "help", A_DEFSYM, 0); - dsp_initclass(); - //class_setname("xtract~", "xtract~"); - - return 0; - -} |