aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--voicing_detector~/help-voicing_detector~.pd188
-rw-r--r--voicing_detector~/help-voicing_detector~test3.pd275
-rw-r--r--voicing_detector~/voicing_detector~.c11
3 files changed, 360 insertions, 114 deletions
diff --git a/voicing_detector~/help-voicing_detector~.pd b/voicing_detector~/help-voicing_detector~.pd
index c5028ac..6faed88 100644
--- a/voicing_detector~/help-voicing_detector~.pd
+++ b/voicing_detector~/help-voicing_detector~.pd
@@ -1,115 +1,85 @@
-#N canvas 0 22 725 399 10;
-#N canvas 0 22 462 312 voicing_detect 0;
-#X obj 89 148 voicing_detector~;
-#X obj 329 147 block~ 1024;
-#X obj 89 91 inlet~;
-#X obj 203 93 inlet;
-#X obj 88 194 outlet;
-#X msg 233 120 bound \$1 \$2;
-#X msg 341 124 method \$1;
-#X obj 273 76 t b f;
-#X obj 254 104 pack 60 500;
-#X obj 255 45 inlet;
-#X obj 297 45 inlet;
-#X text 258 12 frequency;
-#X text 255 25 constraints;
-#X obj 341 93 inlet;
-#X obj 341 109 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X text 341 57 0=avg-mag;
-#X text 341 70 1=mag-diff;
-#X connect 0 0 4 0;
-#X connect 2 0 0 0;
+#N canvas 0 0 510 323 10;
+#N canvas 119 189 450 300 voxdetect 0;
+#X obj 150 156 voicing_detector~;
+#X obj 150 99 inlet~;
+#X obj 307 124 block~ 1024;
+#X obj 264 95 inlet;
+#X obj 220 209 outlet~;
+#X obj 150 238 outlet;
+#X text 81 195 1=voiced;
+#X text 81 214 0=unvoiced;
+#X text 262 76 threshold (0-100);
+#X connect 0 0 5 0;
+#X connect 1 0 0 0;
+#X connect 1 0 4 0;
#X connect 3 0 0 1;
-#X connect 5 0 0 0;
-#X connect 6 0 0 0;
-#X connect 7 0 8 0;
-#X connect 7 1 8 1;
-#X connect 8 0 5 0;
-#X connect 9 0 8 0;
-#X connect 10 0 7 0;
-#X connect 13 0 14 0;
-#X connect 14 0 6 0;
-#X restore 106 203 pd voicing_detect;
-#N canvas 0 22 555 302 playload 0;
-#X obj 28 132 tabplay~ testinput;
-#X obj 28 180 outlet~;
-#X obj 27 78 inlet;
-#X obj 177 74 inlet;
-#X obj 177 105 openpanel;
-#X msg 264 150 read -resize ../sound/voice.wav testinput;
-#X obj 177 139 soundfiler;
-#X msg 177 122 read -resize \$1 testinput;
-#X obj 360 134 loadbang;
-#X connect 0 0 1 0;
+#X restore 96 199 pd voxdetect;
+#X obj 139 71 bng 15 250 50 0 empty empty load-voice -38 -6 0 8 -262144
+-1 -1;
+#N canvas 0 0 450 300 play 0;
+#X obj 82 157 tabplay~ voice;
+#X obj 190 66 inlet;
+#X obj 53 67 inlet;
+#X obj 111 66 inlet;
+#X obj 48 140 metro;
+#X obj 84 196 outlet~;
+#X connect 0 0 5 0;
+#X connect 1 0 4 1;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
+#X connect 4 0 0 0;
+#X restore 95 139 pd play;
+#X obj 95 115 bng 15 250 50 0 empty empty play 0 -6 0 8 -262144 -1
+-1;
+#X obj 117 102 tgl 15 0 empty empty loop 0 -6 0 8 -262144 -1 -1 0 1
+;
+#N canvas 0 0 450 300 load 0;
+#X obj 77 135 soundfiler;
+#X obj 77 169 outlet;
+#X obj 161 101 loadbang;
+#X obj 80 84 openpanel;
+#X obj 80 27 inlet;
+#X msg 8 101 read -resize \$1 voice;
+#X obj 77 152 / 44.1;
+#X obj 114 47 samplerate~;
+#X obj 114 64 / 1000;
+#X msg 77 118 read -resize beauty.wav voice;
+#X connect 0 0 6 0;
+#X connect 2 0 9 0;
+#X connect 3 0 5 0;
+#X connect 4 0 3 0;
#X connect 4 0 7 0;
-#X connect 5 0 6 0;
-#X connect 7 0 6 0;
-#X connect 8 0 5 0;
-#X restore 106 64 pd playload;
-#X msg 178 41 bang;
-#X text 210 40 load file;
-#N canvas 0 0 450 300 graph1 0;
-#X array testinput 1.31596e+06 float 0;
-#X coords 0 1 1.31596e+06 -1 300 100 1;
-#X restore 402 28 graph;
-#N canvas 0 22 454 304 graph1 0;
-#X array voicing 300 float 0;
-#X coords 0 1.1 299 -0.1 300 50 1;
-#X restore 402 130 graph;
-#N canvas 0 22 454 304 graphit 1;
-#X obj 105 53 inlet;
-#X obj 132 153 count 300;
-#X obj 104 82 t f b;
-#X obj 161 53 inlet;
-#X obj 104 187 tabwrite voicing;
-#X connect 0 0 2 0;
-#X connect 1 0 4 1;
-#X connect 2 0 4 0;
-#X connect 2 1 1 0;
-#X connect 3 0 1 1;
-#X restore 107 274 pd graphit;
-#X text 133 321 AMDF Voicing Detector - uses the difference between
-the average and the magnitude of an autocorrelation function to determine
-whether speech is voiced or not.;
-#X text 130 367 (C) 2005 Edward Kelly and Nicolas Chetry;
-#X msg 105 23 bang;
-#X text 141 20 play file;
-#X obj 139 91 adc~;
-#X floatatom 204 114 5 0 0 1 threshold - -;
-#X msg 204 98 20;
-#X obj 204 82 loadbang;
-#X obj 139 114 *~ 0;
-#X obj 179 95 tgl 15 0 empty empty mic 0 -6 0 8 -262144 -1 -1 0 1;
-#X floatatom 106 237 5 0 0 0 - - -;
-#X text 42 228 voiced/;
-#X text 35 241 unvoiced;
-#X floatatom 179 163 5 0 0 0 - - -;
-#X floatatom 220 163 5 0 0 1 constraints - -;
-#X msg 186 139 60;
-#X msg 223 139 500;
-#X text 273 173 (Hz);
-#X obj 250 204 tgl 15 0 empty empty method 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 262 141 loadbang;
-#X connect 0 0 17 0;
-#X connect 1 0 0 0;
-#X connect 2 0 1 1;
-#X connect 9 0 1 0;
-#X connect 9 0 6 1;
-#X connect 11 0 15 0;
-#X connect 12 0 0 1;
-#X connect 13 0 12 0;
+#X connect 5 0 0 0;
+#X connect 6 0 1 0;
+#X connect 7 0 8 0;
+#X connect 8 0 6 1;
+#X connect 9 0 0 0;
+#X restore 139 86 pd load;
+#N canvas 0 0 450 300 graph2 0;
+#X array voice 1.31596e+06 float 0;
+#X coords 0 1 1.31596e+06 -1 100 70 1;
+#X restore 281 55 graph;
+#X floatatom 96 234 5 0 0 0 - - -;
+#X obj 166 233 dac~;
+#X obj 217 44 vsl 15 101 0 100 0 0 empty empty empty 0 -8 0 8 -262144
+-1 -1 3700 1;
+#X floatatom 193 168 5 0 0 0 - - -;
+#X text 79 253 The voicing detector estimates whether a frame of speech
+is voiced (uses the vocal chords) or unvoiced (does not).;
+#X text 128 288 (Gnu) Edward Kelly and Nicolas Chetry 2005;
+#X msg 15 131 \; pd dsp \$1;
+#X obj 15 102 tgl 15 0 empty empty audio_on 0 -6 0 8 -262144 -1 -1
+0 1;
+#X obj 124 162 adc~;
+#X connect 0 0 7 0;
+#X connect 0 1 8 0;
+#X connect 0 1 8 1;
+#X connect 1 0 5 0;
+#X connect 2 0 0 0;
+#X connect 3 0 2 0;
+#X connect 4 0 2 1;
+#X connect 5 0 2 2;
+#X connect 9 0 10 0;
+#X connect 10 0 0 1;
#X connect 14 0 13 0;
#X connect 15 0 0 0;
-#X connect 16 0 15 1;
-#X connect 17 0 6 0;
-#X connect 20 0 0 2;
-#X connect 21 0 0 3;
-#X connect 22 0 20 0;
-#X connect 23 0 21 0;
-#X connect 25 0 0 4;
-#X connect 26 0 23 0;
-#X connect 26 0 22 0;
diff --git a/voicing_detector~/help-voicing_detector~test3.pd b/voicing_detector~/help-voicing_detector~test3.pd
new file mode 100644
index 0000000..f4dedc4
--- /dev/null
+++ b/voicing_detector~/help-voicing_detector~test3.pd
@@ -0,0 +1,275 @@
+#N canvas 0 0 728 435 10;
+#X floatatom 128 105 5 0 100 2 thresh - -;
+#N canvas 0 0 450 300 graph1 0;
+#X array testinput 1.31596e+06 float 2;
+#X coords 0 1 1.31596e+06 -1 300 60 1;
+#X restore 255 18 graph;
+#X obj 115 71 tabplay~ testinput;
+#X obj 575 252 soundfiler;
+#X obj 575 218 openpanel;
+#X msg 575 235 read -resize \$1 testinput;
+#X obj 575 203 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 115 41 bng 15 250 50 0 empty empty play 0 -6 0 8 -262144 -1
+-1;
+#X obj 199 54 spigot;
+#X obj 228 39 tgl 15 0 empty empty loop 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 235 121 tgl 15 0 empty empty on 0 -6 0 8 -262144 -1 -1 1 1;
+#N canvas 0 0 450 300 testload 0;
+#X floatatom 118 256 0 0 0 0 - - -;
+#X obj 118 168 cputime;
+#X obj 118 28 loadbang;
+#X obj 118 112 metro 1000;
+#X msg 118 56 1;
+#X floatatom 118 84 0 0 0 0 - - -;
+#X obj 118 140 t b b;
+#X obj 118 228 * 0.1;
+#X text 163 84 <-- on/off;
+#X text 51 284 CPU load in percent;
+#X connect 1 0 7 0;
+#X connect 2 0 4 0;
+#X connect 3 0 6 0;
+#X connect 4 0 5 0;
+#X connect 5 0 3 0;
+#X connect 6 0 1 0;
+#X connect 6 1 1 1;
+#X connect 7 0 0 0;
+#X restore 62 240 pd testload;
+#N canvas 0 0 450 300 voicingdet~ 0;
+#X obj 95 74 inlet;
+#X obj 51 74 inlet~;
+#X obj 259 117 inlet;
+#X obj 259 137 switch~ 1024 1 1;
+#X obj 51 126 voicing_detector~;
+#X text 83 59 threshold;
+#X obj 151 73 inlet;
+#X text 148 58 search;
+#X obj 206 73 inlet;
+#X obj 165 220 outlet;
+#X obj 51 218 outlet;
+#X text 149 27 peaks;
+#X text 204 40 samples;
+#X text 207 57 window;
+#X connect 0 0 4 1;
+#X connect 1 0 4 0;
+#X connect 2 0 3 0;
+#X connect 4 0 10 0;
+#X connect 4 2 9 0;
+#X connect 6 0 4 2;
+#X connect 8 0 4 3;
+#X restore 116 136 pd voicingdet~;
+#N canvas 0 0 450 300 graph2 0;
+#X array voicing 300 float 3;
+#A 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1
+0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1
+1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0
+0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
+0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1
+1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 1 0;
+#X coords 0 2 299 -1 300 50 1;
+#X restore 254 223 graph;
+#N canvas 0 0 450 300 graph2 0;
+#X array amdf_pitch 300 float 3;
+#A 0 inf 52.6308 inf inf inf inf inf inf inf 61.6769 inf inf 79.9839
+81.0009 81.3891 80.4557 68.64 64.1892 inf 66.4698 50.6665 inf inf inf
+inf inf inf inf 50.6665 50.6665 50.6665 72.3208 80.0773 72.0166 68.0305
+50.6665 inf inf inf inf inf inf inf 50.6665 inf inf inf inf 50.6665
+inf inf 50.6665 50.6665 inf inf inf 50.6665 77.8829 50.6665 inf 61.011
+63.8438 60.475 54.3953 52.2985 inf 58.8633 51.3383 63.4215 71.0568
+62.7265 70.8633 66.6197 inf 50.6665 inf 55.7069 50.6665 50.6665 50.6665
+inf inf inf inf inf inf inf inf inf 70.4828 68.3603 inf 72.7731 50.6665
+inf 62.1356 inf inf 50.6665 inf inf inf inf inf 50.6665 50.6665 50.6665
+71.1217 75.6314 inf inf inf inf inf inf inf inf 50.6665 inf inf inf
+50.6665 inf inf inf inf inf 78.0763 55.3107 50.6665 inf inf inf 50.6665
+inf 50.6665 inf 50.6665 58.9598 76.4972 76.5862 inf 50.6665 50.6665
+inf inf inf 56.3603 50.6665 inf inf 50.6665 inf inf 50.6665 inf 73.5356
+70.5499 76.0095 inf 50.6665 inf inf 50.9078 inf inf inf inf inf inf
+inf inf inf 63.716 79.2014 76.856 inf inf 80.648 50.6665 50.6665 inf
+50.6665 inf inf inf inf 50.6665 inf inf inf inf inf inf 50.6665 inf
+inf inf inf inf inf inf inf 68.4159 inf 50.6665 81.3498 63.4605 81.0393
+inf inf inf inf inf inf 54.5446 60.9024 50.6665 inf 50.6665 inf inf
+inf inf inf inf inf inf inf 57.4776 63.716 55.3107 inf inf inf inf
+inf inf inf 50.6665 inf 50.6665 inf inf inf 50.6665 50.6665 50.6665
+50.6665 50.6665 inf inf inf inf inf inf inf 69.3891 64.6309 inf 50.6665
+inf inf inf 50.6665 inf inf inf 50.6665 inf inf inf 70.4077 80.6965
+79.0156 80.7342 78.1348 76.2328 78.4102 78.9541 inf inf 50.6665 inf
+inf 50.6665 inf 50.6665 inf 50.6665 inf 67.0773 56.6965 inf inf 50.6665
+50.6665 inf inf inf;
+#X coords 0 128 299 0 300 50 1;
+#X restore 253 159 graph;
+#N canvas 0 0 450 300 graph2 0;
+#X array fiddle_pitch 300 float 3;
+#A 0 42.759 42.5032 42.473 54.6862 54.2724 88.0229 88.184 69.9998 46.2469
+46.1609 36.5253 51.6493 56.2251 57.3686 56.4619 54.6808 0 0 54.0894
+93.1511 68.6615 52.7942 81.0395 66.0331 51.7957 0 68.5582 61.4413 52.6465
+71.037 58.4423 91.8432 92.069 40.0203 0 0 36.8793 58.0122 47.6222 46.0941
+91.8441 91.9697 55.7681 56.0344 55.7733 0 80.8823 81.7433 84.8554 57.472
+55.8532 0 115.991 115.665 77.5622 0 92.1532 95.0497 50.2136 50.1965
+49.5168 48.9704 0 110.374 80.4211 81.7533 120.147 96.2099 77.1305 105.556
+105.273 56.8668 57.1058 58.1518 58.2318 58.253 57.9551 57.9389 57.2086
+58.607 58.7608 58.5285 57.4834 56.6055 44.5336 43.9182 0 55.8955 55.8118
+56.3424 55.9227 0 58.3825 73.8235 73.4276 0 55.4181 54.9552 53.5732
+54.7674 0 70.8503 75.9806 82.2004 80.4199 79.4119 68.8766 77.895 104.482
+105.457 0 42.9514 44.0048 0 43.5638 42.7844 43.0441 43.5913 45.0992
+55.9686 55.7438 0 56.3861 0 118.578 119.062 91.5953 84.6976 82.4846
+116.179 80.4236 0 70.9708 52.6736 36.9783 34.1847 42.4984 73.9364 38.2027
+37.8997 74.0349 40.0425 42.1891 0 0 46.7969 0 42.5967 57.7423 55.0562
+55.214 42.5583 0 0 107.128 66.2461 0 70.8881 62.0142 93.8698 70.2977
+69.6271 65.6152 54.8576 82.2464 46.7154 57.0915 52.4897 0 58.2819 0
+0 48.8379 48.3517 86.5587 57.4985 41.8914 100.744 77.1489 88.6531 101.163
+78.1291 0 58.1589 57.7381 56.8702 54.7868 37.3185 55.048 44.2793 43.7839
+43.6901 44.3304 45.5636 46.8364 47.4256 46.8557 0 66.0394 0 0 37.3535
+53.0011 52.3631 50.8664 52.4876 53.4121 53.9883 42.9063 43.671 56.3301
+0 0 0 0 85.7498 92.9351 92.7796 51.8324 51.7119 50.8787 50.212 49.7494
+49.4586 48.6298 57.9294 44.3071 42.9568 42.047 39.9829 40.5865 40.5722
+42.9498 47.521 48.1418 38.3092 52.8257 53.4445 51.6414 50.1592 47.5694
+44.9923 43.6918 42.54 42.1952 42.3799 88.6103 92.9605 90.0537 82.4926
+0 80.5717 41.5044 53.2398 42.4218 38.5483 38.9727 45.9362 46.204 40.1976
+0 102.734 103.735 103.027 42.8539 44.4726 46.0255 46.6465 58.2084 40.4422
+0 70.0279 73.9915 61.9472 70.0716 81.9317 81.5628 94.0509 53.7554 66.0479
+0 46.3012 44.9257 46.9063 47.3438 65.9144 46.9733 104.83 88.2914 79.6901
+0 74.9976 0 71.7403 45.991 44.0293 44.2378 44.1106 43.711 43.0768;
+#X coords 0 128 300 0 300 50 1;
+#X restore 254 94 graph;
+#N canvas 0 0 450 300 voxwrite 0;
+#X obj 87 73 inlet;
+#X obj 87 103 t f b;
+#X obj 117 132 count 300;
+#X obj 87 174 tabwrite voicing;
+#X obj 146 88 r \$0-reset-counters;
+#X connect 0 0 1 0;
+#X connect 1 0 3 0;
+#X connect 1 1 2 0;
+#X connect 2 0 3 1;
+#X connect 4 0 2 1;
+#X restore 116 159 pd voxwrite;
+#N canvas 0 0 450 300 amdfwrite 0;
+#X obj 87 48 inlet;
+#X obj 87 103 t f b;
+#X obj 117 132 count 300;
+#X obj 146 88 r \$0-reset-counters;
+#X obj 87 174 tabwrite amdf_pitch;
+#X obj 87 75 ftom;
+#X connect 0 0 5 0;
+#X connect 1 0 4 0;
+#X connect 1 1 2 0;
+#X connect 2 0 4 1;
+#X connect 3 0 2 1;
+#X connect 5 0 1 0;
+#X restore 146 185 pd amdfwrite;
+#X obj 21 170 unpack f f;
+#N canvas 0 0 450 300 fidwrite 0;
+#X obj 87 73 inlet;
+#X obj 87 103 t f b;
+#X obj 117 132 count 300;
+#X obj 146 88 r \$0-reset-counters;
+#X obj 87 174 tabwrite fiddle_pitch;
+#X connect 0 0 1 0;
+#X connect 1 0 4 0;
+#X connect 1 1 2 0;
+#X connect 2 0 4 1;
+#X connect 3 0 2 1;
+#X restore 21 196 pd fidwrite;
+#X floatatom 173 105 3 3 50 2 peaks - -;
+#N canvas 0 0 450 300 amgatewrite 0;
+#X obj 161 28 inlet;
+#X obj 87 121 t f b;
+#X obj 117 150 count 300;
+#X obj 146 106 r \$0-reset-counters;
+#X obj 59 25 inlet;
+#X obj 59 45 swap;
+#X obj 59 83 spigot;
+#X msg 106 83 0;
+#X obj 87 174 tabwrite amdf_gated_pitch;
+#X connect 0 0 5 1;
+#X connect 1 0 8 0;
+#X connect 1 1 2 0;
+#X connect 2 0 8 1;
+#X connect 3 0 2 1;
+#X connect 4 0 5 0;
+#X connect 5 0 6 0;
+#X connect 5 1 6 1;
+#X connect 5 1 7 0;
+#X connect 6 0 1 0;
+#X connect 7 0 1 0;
+#X restore 107 298 pd amgatewrite;
+#N canvas 0 0 450 300 graph2 0;
+#X array amdf_gated_pitch 300 float 3;
+#A 0 0 0 0 280.892 0 152.595 0 0 0 0 0 0 0 745.652 0 715.135 0 867.135
+0 450 0 807.692 0 295.973 0 210.054 0 0 0 0 0 0 0 0 0 152.595 0 0 0
+0 0 0 0 613.636 0 907.12 0 869.577 0 842.675 0 439.925 0 755.137 0
+658.209 0 550.791 0 0 0 0 0 152.595 0 152.595 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 190.909 0 152.595
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 152.595 0 152.595 0 152.595 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 152.595 0 152.595 0 0 0 0 0 0 0 0 0 0 0 0 152.595
+0 0 0 0 0 152.595 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 152.595 0 0 0 0 0 0 0 0 0 0 0 0 0 152.595 0
+0 0 0 0 0 0 0 0 0 882 0 486.04 0 825.401 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 152.595 0 152.595 0 0 0
+0 0 781.159 0 827.614 0 494.395 0 484.869 0 832.076 0 152.595 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0;
+#X coords 0 128 299 0 300 50 1;
+#X restore 254 288 graph;
+#X floatatom 163 260 5 0 0 0 - - -;
+#X floatatom 177 220 5 0 0 0 - - -;
+#X floatatom 6 237 5 0 0 0 - - -;
+#X obj 106 322 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 105 378 s \$0-reset_counters;
+#X obj 593 56 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X msg 594 99 \; pd dsp \$1;
+#X msg 104 352 0;
+#X obj 575 326 soundfiler;
+#X obj 575 277 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 575 292 savepanel;
+#X msg 575 309 write \$1 testinput;
+#X obj 16 136 fiddle~ 2048 1;
+#X obj 204 255 print;
+#X floatatom 210 105 3 2 50 2 win - -;
+#X obj 160 203 moses 20000;
+#X msg 218 223 0;
+#X obj 176 238 ftom;
+#X floatatom 36 265 5 0 0 0 - - -;
+#X obj 17 314 -;
+#X floatatom 16 339 5 0 0 0 - - -;
+#X connect 0 0 12 1;
+#X connect 2 0 12 0;
+#X connect 2 0 35 0;
+#X connect 2 1 8 0;
+#X connect 4 0 5 0;
+#X connect 5 0 3 0;
+#X connect 6 0 4 0;
+#X connect 7 0 2 0;
+#X connect 8 0 2 0;
+#X connect 9 0 8 1;
+#X connect 10 0 12 4;
+#X connect 12 0 16 0;
+#X connect 12 0 23 0;
+#X connect 12 1 38 0;
+#X connect 18 0 19 0;
+#X connect 18 0 25 0;
+#X connect 20 0 12 2;
+#X connect 23 0 21 0;
+#X connect 24 0 40 0;
+#X connect 25 0 42 0;
+#X connect 26 0 30 0;
+#X connect 28 0 29 0;
+#X connect 30 0 27 0;
+#X connect 32 0 33 0;
+#X connect 33 0 34 0;
+#X connect 34 0 31 0;
+#X connect 35 2 18 0;
+#X connect 37 0 12 3;
+#X connect 38 0 24 0;
+#X connect 38 0 21 1;
+#X connect 38 1 39 0;
+#X connect 39 0 21 1;
+#X connect 40 0 41 0;
+#X connect 41 0 42 1;
+#X connect 42 0 43 0;
diff --git a/voicing_detector~/voicing_detector~.c b/voicing_detector~/voicing_detector~.c
index 5ed5a3d..e069668 100644
--- a/voicing_detector~/voicing_detector~.c
+++ b/voicing_detector~/voicing_detector~.c
@@ -31,8 +31,8 @@ static t_int *voicing_detector_tilde_perform(t_int *w)
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 current, previous, next, temp0, temp1, avg, max, peak0;
+ current = previous = next = temp0 = temp1 = avg = max = peak0 = 0;
t_float min = 1000;
t_float samplerate = sys_getsr();
t_float start = samplerate / x->f_high;
@@ -55,14 +55,15 @@ static t_int *voicing_detector_tilde_perform(t_int *w)
}
for (i=1;i<l;i++)
{
+ temp1 = 0;
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]);
+ temp1 += fabs(in[j] - temp[j]);
}
- temp0 += ((float)i / (float)l) * ctl->f_sum_abs;
- SETFLOAT(&ctl->otemp[i], temp0);
+ temp1 += ((float)i / (float)l) * ctl->f_sum_abs;
+ SETFLOAT(&ctl->otemp[i], temp1);
}
for (i=start+1;i<end;i++)