Hi all,
I put in Iohannes's patches, and, with more effort, tried to fold in the Mac OSX stuff to the original sources... you can get them at
http://crca.ucsd.edu/~msp/Software/pd-0.35-test1.linux.tar.gz
I have one suggestion, which is that I think "block" should really interpret "2" as upsampling by 2, not downsampling... this would be an easy change to make but I'm not sure how much pain it will cause those of you already using sample rate conversion. I think Iohannes has mostly been using block to downsample things, but I think when people catch on to what you can do with upsampling it will catch on. (sawtooth waves and FM and waveshaping all ought to be done at 2 or 4 times output sample rate...!)
If Thomas Musil is game I'd like to replace my number boxes with his and make one more of his GUI objects (the vertical radio button, or is the the horizontal) standard.
I think the next thing is for me to try to get abstractions to have a better mechanism to sprout visible controls. This will introduce lots of bugs that will take a few revisions to sort out...
cheers Miller
Hi,
I put in Iohannes's patches, and, with more effort, tried to fold in the Mac OSX stuff to the original sources... you can get them at
if you doing also the multicard patch of Iohannes, that on linux systems for specify the soundcard(s) nr and channel number for each card, it would be helpfull also to clear the fragsize-problem for the hammerfall, since on hammerfall now you cannot change the buffersize.
I enabled this commenting out
/* if (linux_fragsize != 64) { if (linux_fragsize) post("warning: overiding blocksize to 64!"); linux_fragsize = 64; } */ which in fact I dont know the reason it is in the source.
(btw. since hammerfall has always two fragments, the fragmentnumber always returned by the ioctl call is 2.
and if I do a fragment size like -fragsize 4,5,6,7,8,... pd calulates a fragsize like 128,256,512, ?-) )
Anyhow using the blocksize statement is better and works if the above is commented out, also the audiobuffer value on verbose out is not adjusted and always 40msec, which i can change with the -audiobuf statement, which is fine.
I am not sure if audiobuf message (= sys_schedadvance) has any effect on operation, since the blocksize does the delay input/output and I didnt get any clicks...
If you want I can have a deeper look in it next week, but I got lost somewhere in the sources now, but it works.
mfg winfried
I don't know why, but at some point I had Hammerfall only working at blocksize 64, I think. Anyway, I've commented out the lines in my copy and will see what trouble I get into...
cheers Miller
I enabled this commenting out
/* if (linux_fragsize != 64) { if (linux_fragsize) post("warning: overiding blocksize to 64!"); linux_fragsize = 64; } */ which in fact I dont know the reason it is in the source.
... and this stuff ought to get fixed; I'll look at it too:
(btw. since hammerfall has always two fragments, the fragmentnumber always returned by the ioctl call is 2.
and if I do a fragment size like -fragsize 4,5,6,7,8,... pd calulates a fragsize like 128,256,512, ?-) )
Anyhow using the blocksize statement is better and works if the above is commented out, also the audiobuffer value on verbose out is not adjusted and always 40msec, which i can change with the -audiobuf statement, which is fine.
I am not sure if audiobuf message (= sys_schedadvance) has any effect on operation, since the blocksize does the delay input/output and I didnt get any clicks...
If you want I can have a deeper look in it next week, but I got lost somewhere in the sources now, but it works.
mfg winfried
I have one suggestion, which is that I think "block" should really interpret "2" as upsampling by 2, not downsampling... this would be an easy change to make but I'm not sure how much pain it will cause those of you already using sample rate conversion.
i agree to this (i have written the downsampling things first and have extended them to do both up- and downsampling later; that's why "2" means downsampling now, instead of upsampling) but the changes should be made soon, to prevent people from using it as it is now;
so patch again: (or do the simple changes in d_ugen.c yourself before using the up/downsampling features)
mfg.cds.sad IOhannes
diff -Naur pd-0.35-test3/doc/3.audio.examples/74.up.downsampling.pd pd-0.35-mytest/doc/3.audio.examples/74.up.downsampling.pd --- pd-0.35-test3/doc/3.audio.examples/74.up.downsampling.pd Sat Nov 17 09:19:27 2001 +++ pd-0.35-mytest/doc/3.audio.examples/74.up.downsampling.pd Mon Nov 19 13:37:49 2001 @@ -1,4 +1,4 @@ -#N canvas 15 36 1089 690 10; +#N canvas 32 42 1089 690 10; #X obj 57 567 osc~ 412; #X floatatom 58 543 5 0 0; #X obj 122 595 tabwrite~ scope; @@ -6,35 +6,35 @@ #X msg 205 43 bang; #X obj 42 191 tabwrite~ scope; #X msg 54 165 bang; -#N canvas 470 197 600 400 simple 0; +#N canvas 335 193 600 400 simple 0; #X obj 185 46 inlet; #X obj 185 102 tabwrite~ scope; -#X obj 317 103 block~ 64 1 4; #X obj 78 38 inlet~; #X obj 78 258 outlet~; +#X obj 317 103 block~ 64 1 0.25; #X connect 0 0 1 0; -#X connect 3 0 1 0; -#X connect 3 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 3 0; #X restore 42 64 pd simple downsampling 4; -#X msg 451 42 bang; +#X msg 452 40 bang; #X obj 275 190 tabwrite~ scope; #X msg 287 164 bang; #X graph graph2 0 -1 511 1 297 629 897 489; #X array scope 512 float 0; #X pop; -#X msg 683 45 bang; +#X msg 669 44 bang; #X obj 520 193 tabwrite~ scope; #X msg 532 167 bang; -#X msg 929 44 bang; +#X msg 958 43 bang; #X obj 753 192 tabwrite~ scope; #X msg 765 166 bang; -#N canvas 255 160 600 400 simple 0; +#N canvas 235 161 600 400 simple 0; #X obj 185 74 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 38 inlet~; #X obj 78 258 outlet~; -#X obj 317 103 block~ 64 1 0.25; #X text 130 38 zero-padding upsampling; +#X obj 317 103 block~ 64 1 4; #X connect 0 0 1 0; #X connect 2 0 1 0; #X connect 2 0 3 0; @@ -54,38 +54,36 @@ #X obj 152 416 tabwrite~ scope; #X msg 158 370 bang; #X text 43 431 zero-padded; -#N canvas 220 161 600 400 downsampling 0; -#X obj 317 103 block~ 64 1 4; +#N canvas 176 162 600 400 downsampling 0; #X obj 78 38 inlet~; #X obj 78 258 outlet~; #X obj 152 258 outlet~ hold; -#X connect 1 0 2 0; -#X connect 1 0 3 0; +#X obj 318 103 block~ 64 1 0.25; +#X connect 0 0 1 0; +#X connect 0 0 2 0; #X restore 41 288 pd downsampling 4 (mixed); -#N canvas 215 161 600 400 bad 0; +#N canvas 137 106 600 400 bad 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; -#X obj 78 258 outlet~ lin; -#X obj 78 38 inlet~ lin; -#X text 172 257 "lin" is for linear upsampling; -#X text 160 39 "lin" has no meaning when downsampling; #X obj 317 103 block~ 64 2; +#X obj 78 38 inlet~; +#X obj 78 258 outlet~; #X connect 0 0 1 0; #X connect 3 0 1 0; -#X connect 3 0 2 0; +#X connect 3 0 4 0; #X restore 711 288 pd bad overlap; #X msg 1018 263 bang; #X obj 841 415 tabwrite~ scope; #X msg 853 389 bang; #X obj 841 264 r~ sine; -#N canvas 172 172 600 400 bad 0; +#N canvas 160 172 600 400 bad 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 258 outlet~ lin; #X obj 78 38 inlet~ lin; #X text 172 257 "lin" is for linear upsampling; #X text 160 39 "lin" has no meaning when downsampling; -#X obj 317 103 block~ 64 2 0.5; +#X obj 317 103 block~ 64 2 2; #X connect 0 0 1 0; #X connect 3 0 1 0; #X connect 3 0 2 0; @@ -95,54 +93,54 @@ #X msg 335 391 bang; #X obj 323 266 r~ sine; #X text 155 433 sample&hold; -#X msg 653 265 bang; +#X msg 660 265 bang; #X obj 511 416 tabwrite~ scope; #X msg 523 390 bang; #X obj 511 265 r~ sine; -#N canvas 184 119 600 400 downsampled 0; +#N canvas 167 119 600 400 downsampled 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 258 outlet~ lin; #X obj 78 230 *~ 0.5; -#X obj 317 103 block~ 128 2 2; #X obj 78 38 inlet~; +#X obj 317 103 block~ 128 2 0.5; #X connect 0 0 1 0; #X connect 3 0 2 0; -#X connect 5 0 1 0; -#X connect 5 0 3 0; +#X connect 4 0 1 0; +#X connect 4 0 3 0; #X restore 511 289 pd downsampled overlap; -#N canvas 97 100 600 400 upsampled 0; +#N canvas 88 100 600 400 upsampled 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 258 outlet~ lin; #X obj 78 38 inlet~ lin; -#X obj 317 103 block~ 256 2 0.5; #X obj 78 230 *~ 0.5; +#X obj 317 103 block~ 256 2 2; #X connect 0 0 1 0; #X connect 3 0 1 0; -#X connect 3 0 5 0; -#X connect 5 0 2 0; +#X connect 3 0 4 0; +#X connect 4 0 2 0; #X restore 323 290 pd upsampled overlap; -#N canvas 214 111 600 400 upsampling 0; +#N canvas 164 135 600 400 upsampling 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 38 inlet~ hold; #X obj 78 258 outlet~; #X text 160 39 "hold" is for sample&hold upsampling; -#X text 397 128 0.25=1/4 --> 4* upsampling; -#X obj 317 103 block~ 64 1 0.0625; +#X obj 317 103 block~ 64 1 16; #X connect 0 0 1 0; #X connect 2 0 1 0; #X connect 2 0 3 0; #X restore 753 65 pd upsampling 16 (sample&hold); -#N canvas 246 175 600 400 downsampling 0; +#N canvas 166 169 600 400 downsampling 0; #X obj 185 81 inlet; #X obj 185 102 tabwrite~ scope; #X obj 78 258 outlet~ lin; #X obj 78 38 inlet~ lin; #X text 172 257 "lin" is for linear upsampling; #X text 160 39 "lin" has no meaning when downsampling; -#X obj 320 102 block~ 64 1 8; +#X obj 320 102 block~ 64 1 0.125; +#X text 330 131 0.125 = 1/8 = 8*downsampling; #X connect 0 0 1 0; #X connect 3 0 1 0; #X connect 3 0 2 0; diff -Naur pd-0.35-test3/src/d_ugen.c pd-0.35-mytest/src/d_ugen.c --- pd-0.35-test3/src/d_ugen.c Sat Nov 17 09:21:14 2001 +++ pd-0.35-mytest/src/d_ugen.c Mon Nov 19 13:38:17 2001 @@ -135,7 +135,7 @@ } t_block;
static void *block_new(t_floatarg fvecsize, t_floatarg foverlap,
t_floatarg fdownsample) /* IOhannes */
t_floatarg fupsample) /* IOhannes */
{ int vecsize = fvecsize; int overlap = foverlap; @@ -147,13 +147,13 @@ vecsize = 0; /* this means we'll get it from parent later. */
/* IOhannes { */
downsample = fdownsample;
upsample = 1;
upsample = fupsample;
downsample = 1;
} else { upsample = 1.0 / fdownsample;
downsample = 1;
downsample = 1. / fupsample;
upsample = 1;
}
/* } IOhannes */@@ -196,9 +196,9 @@ }
static void *switch_new(t_floatarg fvecsize, t_floatarg foverlap,
t_floatarg fdownsample) /* IOhannes */
t_floatarg fupsample) /* IOhannes */
{