Forums > MaxMSP

Mapping troubles

April 21, 2006 | 1:11 am

Evening,

I have been trying to map a slider to act as a scrathcer for sfplay~. From the middle to the right side of the slider needs to be mapped to give a value range of 1 to 2, and from middle to left needs to cover the range -1 to -2. How can it be done? Any ideas?

Thanks

J

Here is my attempt so far

max v2;
#N vpatcher 15 55 1018 805;
#P user ezdac~ 116 317 160 350 0;
#P window setfont "Sans Serif" 9.;
#P message 305 595 46 9109513 speed $1;
#P flonum 383 566 52 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 381 532 27 9109513 – 0.;
#P newex 350 495 65 9109513 value scratch;
#P button 350 432 15 0;
#P newex 413 377 27 9109513 – 1.;
#P flonum 281 468 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 318 347 14 9109513 2;
#P newex 329 378 65 9109513 value scratch;
#P button 329 326 15 0;
#P newex 281 408 27 9109513 – 0.;
#P number 206 287 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 206 258 27 9109513 * 2.;
#P flonum 413 298 52 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 483 347 52 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 413 262 38 9109513 * 0.001;
#P flonum 413 428 52 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 597 320 64 9109513 expr $f1*(-1.);
#P flonum 284 298 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 284 264 38 9109513 * 0.001;
#P number 413 231 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 284 230 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 364 172 48 9109513 split 1000;
#P user hslider 379 108 18 128 2001 1 0 0;
#P newex 482 325 37 9109513 – 1000.;
#P toggle 102 247 15 0;
#P message 122 246 28 9109513 open;
#N sfplay~ 2 120960 0 ;
#P newobj 102 284 48 9109513 sfplay~ 2;
#P window setfont "Sans Serif" 12.;
#P window linecount 4;
#P comment 525 109 270 9109516 From middle to the right side of the slider needs to be mapped to give a value range of 1 to 2 , and from middle to left needs to cover the range -1 to -2. How can it be done?;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 333 460 14 9109513 1;
#P fasten 29 0 2 0 310 639 107 639;
#P connect 4 0 2 0;
#P connect 3 0 2 0;
#P connect 2 0 30 0;
#P connect 2 1 30 1;
#P fasten 8 0 17 0 289 251 211 251;
#P connect 17 0 18 0;
#P fasten 11 0 19 0 289 360 286 360;
#P fasten 19 0 23 0 286 447 286 447;
#P fasten 7 0 8 0 369 210 289 210;
#P connect 8 0 10 0;
#P connect 10 0 11 0;
#P fasten 23 0 29 0 286 539 310 539;
#P connect 28 0 29 0;
#P fasten 20 0 22 0 334 343 323 343;
#P fasten 7 0 20 0 369 258 334 258;
#P fasten 20 0 21 0 334 373 334 373;
#P fasten 22 0 21 0 323 368 334 368;
#P fasten 25 0 0 0 355 453 338 453;
#P fasten 7 1 25 0 407 429 355 429;
#P connect 25 0 26 0;
#P fasten 0 0 26 0 338 486 355 486;
#P connect 6 0 7 0;
#P connect 26 0 27 0;
#P connect 27 0 28 0;
#P fasten 13 0 27 1 418 516 403 516;
#P fasten 7 1 9 0 407 211 418 211;
#P fasten 9 0 14 0 418 255 418 255;
#P connect 14 0 16 0;
#P connect 16 0 24 0;
#P fasten 24 0 13 0 418 412 418 412;
#P connect 5 0 15 0;
#P pop;


April 21, 2006 | 9:57 am


April 21, 2006 | 1:13 pm

THANK YOU!!!! Yes that is exactly what I mean, my maths skills must be appalling not to be able to work that out. Cheers!

Jay


April 23, 2006 | 6:39 pm


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