aboutsummaryrefslogtreecommitdiff
path: root/pd/extra
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2009-05-05 22:00:54 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2009-05-05 22:00:54 +0000
commit739722ebea4f44e25c51526311c7c248208b5702 (patch)
treec6b60b84fbd0dd91b6f62b2a5982840aadac9ad9 /pd/extra
parent35de802c640a4e171092b18e57cb1ac1fc49da12 (diff)
bug fixes for pd 0.42-5
svn path=/trunk/; revision=11236
Diffstat (limited to 'pd/extra')
-rw-r--r--pd/extra/bonk~/bonk~-help.pd62
-rw-r--r--pd/extra/lrshift~/lrshift~-help.pd20
-rw-r--r--pd/extra/lrshift~/lrshift~.c4
-rw-r--r--pd/extra/pd~/pd~.c73
4 files changed, 89 insertions, 70 deletions
diff --git a/pd/extra/bonk~/bonk~-help.pd b/pd/extra/bonk~/bonk~-help.pd
index b1b93f62..e52b7c50 100644
--- a/pd/extra/bonk~/bonk~-help.pd
+++ b/pd/extra/bonk~/bonk~-help.pd
@@ -1,9 +1,9 @@
-#N canvas 33 37 964 579 12;
+#N canvas 43 123 1054 583 12;
#X obj 382 492 spigot;
-#X msg 452 292 bang;
-#X obj 452 456 bonk~;
-#X msg 452 359 print;
-#X obj 396 429 adc~;
+#X msg 484 293 bang;
+#X obj 483 454 bonk~;
+#X msg 483 357 print;
+#X obj 435 428 adc~;
#X msg 637 506 \; pd dsp 1;
#X obj 300 492 spigot;
#N canvas 366 126 604 404 synth 0;
@@ -63,30 +63,30 @@
#X msg 900 470 90;
#X text 625 472 click here;
#X text 626 485 to start DSP;
-#X text 5 284 In this patch \, after starting DSP \, you can print
+#X text 5 285 In this patch \, after starting DSP \, you can print
out the raw or cooked output using the two "spigots" or listen to a
synthesizer output by raising its volume.;
#X text 770 469 output volume;
#X text 784 487 (0-100);
-#X msg 452 140 mask 4 0.7;
-#X text 547 122 Describes how energy in each frequency band masks later
+#X msg 483 138 mask 4 0.7;
+#X text 578 120 Describes how energy in each frequency band masks later
energy in the band. Here the masking is total for 4 analysis periods
and then drops by 0.7 each period.;
-#X text 497 288 Poll the current spectrum via "raw" outlet \, You can
+#X text 528 286 Poll the current spectrum via "raw" outlet \, You can
set a very high threshold if you don't want attacks mixed in.;
-#X msg 452 333 debug 0;
-#X text 530 333 turn debugging on or off.;
+#X msg 483 331 debug 0;
+#X text 561 331 turn debugging on or off.;
#X obj 349 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 431 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 382 522 print cooked;
#X obj 300 522 print raw;
-#X text 182 493 enable printout:;
-#X text 529 204 Minimum "velocity" to output (quieter notes are ignored.)
+#X text 162 491 enable printout:;
+#X text 560 202 Minimum "velocity" to output (quieter notes are ignored.)
;
#X obj 485 481 s bonk-cooked;
-#X text 8 144 Bonk's two outputs are the raw spectrum of the attack
+#X text 8 145 Bonk's two outputs are the raw spectrum of the attack
(provided as a list of 11 numbers giving the signal "loudness" in the
11 frequency bands used) \, and the "cooked" output which gives only
an instrument number (counting up from zero) and a "velocity". This
@@ -94,20 +94,20 @@ an instrument number (counting up from zero) and a "velocity". This
bands \, normalized so that 100 is an attack of amplitude of about
1 The instrument number is significant only if Bonk has a "template
set" in memory.;
-#X text 549 37 Set low and high thresholds. Signal growth must exceed
+#X text 580 35 Set low and high thresholds. Signal growth must exceed
the high one and then fall to the low one to make an attack. The unit
is the sum of the proportional growth in the 11 filter bands. Proportional
growth is essentially the logarithmic time derivative.;
-#X msg 452 386 print 1;
-#X text 520 388 print out filterbank settings;
-#X text 9 32 The Bonk object takes an audio signal input and looks
+#X msg 483 384 print 1;
+#X text 551 386 print out filterbank settings;
+#X text 9 33 The Bonk object takes an audio signal input and looks
for "attacks" defined as sharp changes in the spectral envelope of
the incoming sound. Optionally \, and less reliably \, you can have
Bonk check the attack against a collection of stored templates to try
to guess which of two or more instruments was hit. Bonk is described
theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
.;
-#N canvas 422 63 701 719 creation-arguments 0;
+#N canvas 723 241 701 719 creation-arguments 0;
#X text 228 14 creation arguments for bonk~;
#X text 70 272 -npts 256;
#X text 44 244 default value:;
@@ -167,24 +167,24 @@ to erase and record over a template.;
#X connect 3 0 6 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
-#X restore 469 423 pd templates;
-#X msg 452 70 thresh 2.5 5;
-#X msg 452 175 attack-frames 1;
-#X text 574 176 number of frames over which to measure growth;
-#X text 564 423 more messages for managing templates;
-#X msg 452 203 minvel 7;
-#X msg 452 230 spew 0;
-#X text 519 232 Turn spew mode on/off;
-#X msg 452 257 useloudness 0;
-#X text 558 265 experimental: use alternative loudness units;
+#X restore 500 421 pd templates;
+#X msg 483 68 thresh 2.5 5;
+#X msg 483 173 attack-frames 1;
+#X text 608 174 number of frames over which to measure growth;
+#X text 605 422 more messages for managing templates;
+#X msg 483 201 minvel 7;
+#X msg 483 228 spew 0;
+#X text 550 230 Turn spew mode on/off;
+#X msg 483 255 useloudness 0;
+#X text 597 254 experimental: use alternative loudness units;
#X text 212 9 BONK~ - attack detection and spectral envelope measurement
;
#X text 734 552 Updated for Pd version 0.42;
-#X text 5 343 By default bonk's analysis is carried out on a 256-point
+#X text 5 344 By default bonk's analysis is carried out on a 256-point
window (6 msec at 44.1 kHz) and the analysis period is 128 samples.
These and other parameters may be overridden using creation arguments
as shown in the subpatch below:;
-#X text 521 358 Print out settings and templates.;
+#X text 552 356 Print out settings and templates.;
#X connect 0 0 23 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
diff --git a/pd/extra/lrshift~/lrshift~-help.pd b/pd/extra/lrshift~/lrshift~-help.pd
index cdfd8830..fdf7b0c5 100644
--- a/pd/extra/lrshift~/lrshift~-help.pd
+++ b/pd/extra/lrshift~/lrshift~-help.pd
@@ -10,20 +10,24 @@
#X text 243 224 shift right;
#X obj 161 252 lrshift~ 1;
#X obj 244 251 lrshift~ -1;
-#X text 39 37 Acting at whatever vector size the window is running at \, lrshift~ shifts samples to the left (toward the beginning sample) or to the right. The argument gives the direction and the amount of the shift. The rightmost (or leftmost) samples are set to zero.;
-#X graph graph2 0 0 63 1 448 258 648 118;
-#X array shiftin 64 float;
-#X pop;
-#X obj 47 11 rlshift~;
+#X text 39 37 Acting at whatever vector size the window is running
+at \, lrshift~ shifts samples to the left (toward the beginning sample)
+or to the right. The argument gives the direction and the amount of
+the shift. The rightmost (or leftmost) samples are set to zero.;
+#N canvas 0 0 450 300 (subpatch) 0;
+#X array shiftin 64 float 0;
+#X coords 0 1 63 0 200 140 1;
+#X restore 448 118 graph;
#X text 115 11 -- shift signal vector elements left or right;
#X msg 54 138 \; pd dsp 1 \; shiftin 1 1;
#X obj 48 204 tabreceive~ shiftin;
#X text 525 308 Updated for Pd 0.31.;
+#X obj 47 11 lrshift~;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 5 0 6 0;
#X connect 9 0 3 0;
#X connect 10 0 1 0;
-#X connect 16 0 6 0;
-#X connect 16 0 9 0;
-#X connect 16 0 10 0;
+#X connect 15 0 6 0;
+#X connect 15 0 9 0;
+#X connect 15 0 10 0;
diff --git a/pd/extra/lrshift~/lrshift~.c b/pd/extra/lrshift~/lrshift~.c
index ba1d5eeb..166facc1 100644
--- a/pd/extra/lrshift~/lrshift~.c
+++ b/pd/extra/lrshift~/lrshift~.c
@@ -8,6 +8,7 @@ typedef struct _lrshift_tilde
{
t_object x_obj;
int x_n;
+ float x_f;
} t_lrshift_tilde;
static t_int *leftshift_perform(t_int *w)
@@ -59,6 +60,7 @@ static void *lrshift_tilde_new(t_floatarg f)
{
t_lrshift_tilde *x = (t_lrshift_tilde *)pd_new(lrshift_tilde_class);
x->x_n = f;
+ x->x_f = 0;
outlet_new(&x->x_obj, gensym("signal"));
return (x);
}
@@ -68,7 +70,7 @@ void lrshift_tilde_setup(void)
lrshift_tilde_class = class_new(gensym("lrshift~"),
(t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
A_DEFFLOAT, 0);
- class_addmethod(lrshift_tilde_class, nullfn, gensym("signal"), 0);
+ CLASS_MAINSIGNALIN(lrshift_tilde_class, t_lrshift_tilde, x_f);
class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp,
gensym("dsp"), 0);
}
diff --git a/pd/extra/pd~/pd~.c b/pd/extra/pd~/pd~.c
index eba594c8..165065f8 100644
--- a/pd/extra/pd~/pd~.c
+++ b/pd/extra/pd~/pd~.c
@@ -289,7 +289,9 @@ static t_int *pd_tilde_perform(t_int *w)
if (!infd)
goto zeroit;
fprintf(x->x_outfd, ";\n");
- for (i = 0; i < x->x_ninsig; i++)
+ if (!x->x_ninsig)
+ fprintf(x->x_outfd, "0\n");
+ else for (i = 0; i < x->x_ninsig; i++)
{
t_sample *fp = x->x_insig[i];
for (j = 0; j < n; j++)
@@ -373,7 +375,7 @@ static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
int argc, t_atom *argv)
{
t_symbol *sel = ((argc > 0 && argv->a_type == A_SYMBOL) ?
- argv->a_w.w_symbol : gensym("?"));
+ argv->a_w.w_symbol : gensym("?")), *schedlibdir;
char *patchdir;
if (sel == gensym("start"))
{
@@ -392,11 +394,14 @@ static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
}
patchdir = canvas_getdir(x->x_canvas)->s_name;
#endif
-#ifdef MAX
+#ifdef MSP
while (argc--)
{
+ /* because Mac pathnames sometimes have an evil preceeding
+ colon character, we test for and silently eat them */
if (argv->a_type == A_SYM)
- strncat(pdargstring, argv->a_w.w_sym->s_name,
+ strncat(pdargstring, (*argv->a_w.w_sym->s_name == ':'?
+ argv->a_w.w_sym->s_name+1 : argv->a_w.w_sym->s_name),
MAXPDSTRING - strlen(pdargstring)-3);
else if (argv->a_type == A_LONG)
snprintf(pdargstring+strlen(pdargstring),
@@ -411,7 +416,17 @@ static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
}
patchdir = ".";
#endif
- pd_tilde_donew(x, x->x_pddir->s_name, x->x_schedlibdir->s_name,
+ schedlibdir = x->x_schedlibdir;
+ if (schedlibdir == gensym(".") && x->x_pddir != gensym("."))
+ {
+ char *pds = x->x_pddir->s_name, scheddirstring[MAXPDSTRING];
+ int l = strlen(pds);
+ if (l >= 4 && (!strcmp(pds+l-3, "bin") || !strcmp(pds+l-4, "bin/")))
+ snprintf(scheddirstring, MAXPDSTRING, "%s/../extra/pd~", pds);
+ else snprintf(scheddirstring, MAXPDSTRING, "%s/extra/pd~", pds);
+ schedlibdir = gensym(scheddirstring);
+ }
+ pd_tilde_donew(x, x->x_pddir->s_name, schedlibdir->s_name,
patchdir, pdargstring, x->x_ninsig, x->x_noutsig, x->x_fifo,
x->x_sr);
}
@@ -420,6 +435,19 @@ static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
if (x->x_infd)
pd_tilde_close(x);
}
+ else if (sel == gensym("pddir"))
+ {
+ if ((argc > 1) && argv[1].a_type == A_SYMBOL)
+ {
+ t_symbol *sym = argv[1].a_w.w_symbol;
+#ifdef MSP
+ if (sym->s_name[0] == ':')
+ sym = gensym(s->s_name+1);
+#endif
+ x->x_pddir = sym;
+ }
+ else ERROR "pd~ pddir: needs symbol argument");
+ }
else ERROR "pd~: unknown control message: %s", sel->s_name);
}
@@ -594,20 +622,15 @@ static void pd_tilde_tick(t_pd_tilde *x)
if (i > messstart + 1)
{
void *whom;
- if (vec[messstart].a_type != A_SYM)
- ERROR "pd_tilde_tick got non-symbol?");
- else if (!(whom = vec[messstart].a_w.w_sym->s_thing))
- ERROR "%s: no such object",
- vec[messstart].a_w.w_sym->s_name);
- else if (vec[messstart+1].a_type == A_SYM)
- typedmess(whom, vec[messstart+1].a_w.w_sym,
- i-messstart-2, vec+(messstart+2));
- else if (vec[messstart+1].a_type == A_FLOAT && i == messstart+2)
- typedmess(whom, gensym("float"), 1, vec+(messstart+1));
- else if (vec[messstart+1].a_type == A_LONG && i == messstart+2)
- typedmess(whom, gensym("int"), 1, vec+(messstart+1));
- else typedmess(whom, gensym("list"),
- i-messstart-1, vec+(messstart+1));
+ if (vec[messstart].a_type == A_SYM)
+ outlet_anything(x->x_outlet1, vec[messstart].a_w.w_sym,
+ i-messstart-1, vec+(messstart+1));
+ else if (vec[messstart].a_type == A_FLOAT && i == messstart+1)
+ outlet_float(x->x_outlet1, vec[messstart].a_w.w_float);
+ else if (vec[messstart].a_type == A_LONG && i == messstart+1)
+ outlet_int(x->x_outlet1, vec[messstart].a_w.w_long);
+ else outlet_list(x->x_outlet1, gensym("list"),
+ i-messstart, vec+(messstart));
}
messstart = i+1;
}
@@ -711,20 +734,10 @@ static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
}
else break;
}
- if (scheddir == gensym(".") && pddir != gensym("."))
- {
- char *pds = pddir->s_name, scheddirstring[MAXPDSTRING];
- int l = strlen(pds);
- if (l >= 4 && (!strcmp(pds+l-3, "bin") || !strcmp(pds+l-4, "bin/")))
- snprintf(scheddirstring, MAXPDSTRING, "%s/../extra/pd~", pds);
- else snprintf(scheddirstring, MAXPDSTRING, "%s/extra/pd~", pds);
- scheddir = gensym(scheddirstring);
- }
if (ac)
post("pd~: warning: ignoring extra arguments");
- post("pd~: pddir %s scheddir %s",
- pddir->s_name, scheddir->s_name);
dsp_setup((t_pxobject *)x, ninsig);
+ x->x_outlet1 = outlet_new(&x->x_obj, 0);
for (j = 0; j < noutsig; j++)
outlet_new((t_pxobject *)x, "signal");
x->x_clock = clock_new(x, (method)pd_tilde_tick);