Forums > MaxMSP

Tuning Stringresonator (karplus strong)

October 25, 2006 | 9:54 am

Hi,

I’m having troubles with tuning a stringresonator i made (karplus strong). I’ve tried many things, analyzed frequencies, looking at the vectorsize…

But i can’t get it right, even can’t even get a clear octave out of it.

Does anybody know how to this properly?

Thanks in advance,
poul

Patch:

max v2;
#N vpatcher 0 0 1024 700;
#P origin 0 -62;
#P window setfont "Sans Serif" 9.;
#P newex 537 33 31 9109513 r freq;
#P comment 328 494 146 9109513 a sine to compare frequencies;
#P newex 291 473 31 9109513 r freq;
#P newex 291 494 36 9109513 cycle~;
#P user gain~ 290 515 24 100 158 0 1.071519 7.94321 10.;
#P user meter~ 313 515 326 637 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user ezdac~ 253 641 297 674 0;
#P user gain~ 253 515 24 100 158 0 1.071519 7.94321 10.;
#P user meter~ 276 515 289 637 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P newex 445 629 33 9109513 s freq;
#P newex 445 604 28 9109513 mtof;
#P user kslider 445 542 54 0 36 72 31 12 0 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P newex 28 29 69 9109513 receive~ pulse;
#P newex 672 396 58 9109513 send~ pulse;
#P comment 743 182 232 9109513 click for pulse to be resonated every half second;
#P toggle 727 182 15 0;
#P newex 727 199 50 9109513 metro 500;
#P newex 790 339 27 9109513 line~;
#P button 727 220 15 0;
#P user function 727 237 927 337 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 10.638297 1. 0;
#X add 15.957446 0. 0;
#X domain 1000.;
#X range 0. 1.;
#X done;
#P newex 672 370 27 9109513 *~;
#P newex 672 328 30 9109513 pink~;
#P window linecount 3;
#P comment 614 64 287 9109513 here i tried different multiplications after analyzing the difference in Hz (between given frequency and the frequency heard). but the ratio depends per frequency;
#P window linecount 1;
#P newex 537 66 27 9109513 * 1.;
#P newex 100 465 27 9109513 – 64.;
#P newex 45 366 45 9109513 dcblock~;
#P newex 26 509 45 9109513 dcblock~;
#P newex 49 444 62 9109513 mstosamps~;
#P newex 26 485 36 9109513 delay~;
#P newex 537 87 40 9109513 !/ 4410.;
#P newex 206 67 27 9109513 * 8.;
#P newex 384 299 27 9109513 * 8.;
#P newex 26 555 38 9109513 *~ 0.99;
#P newex 45 345 109 9109513 receive~ 1stringloopFB;
#P newex 26 577 98 9109513 send~ 1stringloopFB;
#P comment 98 291 71 9109513 pluck position;
#P user filtergraph~ 219 320 247 93 139 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 1;
#X setfilter 0 1 0 0 0 2093.004639 1. 0.652998 0. 0. 0. 0. 0. 0.;
#X done;
#P newex 27 421 79 9109513 biquad~;
#P newex 28 389 27 9109513 +~;
#P newex 28 323 27 9109513 +~;
#P newex 45 289 52 9109513 tapout~ 25;
#P newex 45 240 33 9109513 tapin~;
#P newex 41 60 45 9109513 loadbang;
#P message 83 83 56 9109513 gainmode 0;
#P message 41 83 41 9109513 lowpass;
#P user filtergraph~ 41 104 247 93 139 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 1;
#X setfilter 0 1 0 0 0 2093.004639 1. 2.466316 0. 0. 0. 0. 0. 0.;
#X done;
#P newex 28 204 79 9109513 biquad~;
#P comment 219 88 69 9109513 timbre control;
#P window linecount 2;
#P comment 128 465 150 9109513 minus vectorsize for compesating the delay of Max itself?;
#P window linecount 1;
#P comment 565 68 64 9109513 >>>>>>>>;
#P comment 850 526 100 9109513 set frequency:;
#P connect 13 0 22 0;
#P connect 22 0 24 0;
#P connect 24 0 18 0;
#P connect 18 0 16 0;
#P connect 12 0 13 0;
#P connect 38 0 4 0;
#P connect 4 0 11 0;
#P connect 11 0 12 0;
#P fasten 14 0 13 1 224 417 45 417;
#P connect 8 0 6 0;
#P connect 6 0 5 0;
#P fasten 7 0 5 0 88 102 46 102;
#P connect 5 0 4 1;
#P connect 4 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 1;
#P connect 17 0 25 0;
#P connect 25 0 12 1;
#P fasten 21 0 23 0 542 442 54 442;
#P connect 26 0 22 1;
#P fasten 8 0 7 0 46 81 88 81;
#P connect 23 1 26 0;
#P fasten 50 0 20 0 542 59 211 59;
#P connect 20 0 5 5;
#P fasten 24 0 43 0 232 528 232 507 258 507;
#P connect 46 0 44 0;
#P connect 43 0 44 0;
#P hidden connect 43 0 42 0;
#P connect 46 0 44 1;
#P fasten 43 0 44 1 258 639 292 639;
#P connect 47 0 46 0;
#P connect 48 0 47 0;
#P hidden connect 46 0 45 0;
#P connect 50 0 19 0;
#P connect 19 0 14 5;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 50 0 27 0;
#P connect 27 0 21 0;
#P connect 29 0 30 0;
#P connect 30 0 37 0;
#P fasten 33 0 30 1 795 363 694 363;
#P connect 35 0 34 0;
#P connect 34 0 32 0;
#P connect 32 0 31 0;
#P connect 31 1 33 0;
#P pop;


October 25, 2006 | 1:55 pm

I’ve been on this case for a while. I asked Luke Dubois, who
bassically, said that it was technically impossible but suggested
adding a tiny bit of noise to the delay time and then everything
sounds in tune.

the reason is A, that all frequencies dont fall easily into a
specific number of samples and B, the vector thing.

gotta go. sorry for no more info

-matt


October 25, 2006 | 2:53 pm


October 27, 2006 | 7:21 am

poul wrote:
> Hi,
>
> I’m having troubles with tuning a stringresonator i made (karplus strong). I’ve tried many things, analyzed frequencies, looking at the vectorsize…
>
> But i can’t get it right, even can’t even get a clear octave out of it.
>
> Does anybody know how to this properly?

I had exactly the same problem. The reason is that the feedback is
limited to a whole number of samples. This will give you a very limited
resolution frequency wise. On thing is to round properly, that helps,
but its still out of tune, the other is to upsample within a poly~ to
get a better resolution. I tried to get a sort of interpolation by
varying the feedback length every x loops by one sample…

But as I look at your patch ,you don’t calculate the delay at all…
The delay will determine the pitch in the karplus strong…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


October 27, 2006 | 9:07 am

Quote: Stefan Tiedje wrote on Fri, 27 October 2006 01:21
—————————————————-

> But as I look at your patch ,you don’t calculate the delay at all…
> The delay will determine the pitch in the karplus strong…
>
> Stefan

uhm, of course i calculate the delay!, take another look :)

but i have the solution allready -> teeth~ (thanks roman!)

the only point with teeth is that the feedbackline is inside the object so you can’t manipulate it, with a filter for instance

poul


October 28, 2006 | 1:37 pm

poul wrote:
> uhm, of course i calculate the delay!, take another look :)

yeah, got it…
but you can’t get it shorter than the vector size… And you don’t need
to compensate, as if the delay is longer than the vector size, it will
be correct…
I looked at my solution and I stuck with tapin~/tapout~ for the same
reson as you did (a filter in the feedback)
But I used a simple onepole~ and put all into a poly~ with vs 8. That
way I got reasonable good tuning even in the high range. And didn’t need
to have the complete patch at that expensive vector size…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


Viewing 6 posts - 1 through 6 (of 6 total)