changeset 121:25fc4d0767f9

- Max example tweaks - corrected output display in simpletest example
author Jamie Bullock <jamie@postlude.co.uk>
date Mon, 23 Aug 2010 11:28:39 +0000
parents d9c5cd78abaa
children 571c53e87dbd
files examples/MSP/Makefile examples/MSP/test/xtract-test examples/MSP/test/xtract-test.pat examples/simpletest/simpletest.c
diffstat 4 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/examples/MSP/Makefile	Wed Feb 03 22:35:13 2010 +0000
+++ b/examples/MSP/Makefile	Mon Aug 23 11:28:39 2010 +0000
@@ -4,22 +4,28 @@
 all: universal
 current: universal
 
-MAXINCLUDE = /usr/local/include/max-includes 
-MSPINCLUDE = /usr/local/include/msp-includes 
 FRAMEWORKS = /Library/Frameworks
-INSTALLDIR = /Applications/Audio/MaxMSP\ 4.6.3/Cycling\ \'74/externals/
+MAXINCLUDE = $(FRAMEWORKS)/MaxAPI.framework/Headers
+MSPINCLUDE = $(FRAMEWORKS)/MaxAudioAPI.framework/Headers
+INSTALLDIR = /Applications/Max5/Cycling\ \'74/externals/
+XTRACT_HEADERS = /usr/local/include
+FFTW_LIBS = -lfftw3f #include this if you compiled libxtract with --enable-fft
 
 LIPO = /usr/bin/lipo
 CC = gcc
 
-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) -include macho-prefix.h  -Werror
+#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) -include macho-prefix.pch $(DEBUG_FLAGS) -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I$(XTRACT_HEADERS)
 
 I386CFLAGS = -arch i386 
+IX86_64CFLAGS = -arch x86_64
 PPCCFLAGS = -arch ppc -faltivec -fasm-blocks -Wno-unused
 
-LDFLAGS = -F$(FRAMEWORKS) -L$(MAXINCLUDE) -L$(MSPINCLUDE) -framework Carbon -framework MaxAPI -framework MaxAudioAPI -Wl,-Y,1455 -bundle -L/usr/local/lib -lxtract
+LDFLAGS = -F$(FRAMEWORKS) -L$(MAXINCLUDE) -L$(MSPINCLUDE) -framework Carbon -framework MaxAPI -framework MaxAudioAPI -Wl,-Y,1455 -bundle -L/usr/local/lib -lxtract $(FFTW_LIBS)
 
 I386LDFLAGS = -arch i386
+IX86_64CFLAGS = -arch x86_64
 PPCLDFLAGS = -arch ppc
 
 universal: 
@@ -48,11 +54,18 @@
 	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 *i386* *ppc* xtract~ *.mxo
-
-maintainer-clean:
-	rm -rf *i386* *ppc* xtract~ *.mxo
+	rm -rf *64* *i386* *ppc* xtract~ *.mxo
 
 install:
 	$(INSTALL) cp -r $(NAME).mxo $(INSTALLDIR)
--- a/examples/MSP/test/xtract-test	Wed Feb 03 22:35:13 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/MSP/test/xtract-test.pat	Mon Aug 23 11:28:39 2010 +0000
@@ -0,0 +1,1 @@
+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
--- a/examples/simpletest/simpletest.c	Wed Feb 03 22:35:13 2010 +0000
+++ b/examples/simpletest/simpletest.c	Mon Aug 23 11:28:39 2010 +0000
@@ -37,7 +37,7 @@
     xtract_init_fft(N, XTRACT_SPECTRUM);
     xtract[XTRACT_SPECTRUM]((void *)&vector, N, &argf[0], (void *)&spectrum[0]);
 
-    printf("\nThe mean of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = %.1f\n\n", mean);
+    printf("\nThe mean of [.1, .2, .3, .4, -.5, -.4, -.3, -.2, -.1] = %.1f\n\n", mean);
     printf("\nResults of xtract_spectrum():\n");
 
     for(n = 0; n < N; n++){