Forums > MaxMSP

object for recieving only first / last of several numbers?

September 12, 2006 | 12:14 pm

hey,
after a long break of maxing, I’m trying to get my head around it all again, trying to make a live performace patch. I apologise if this question is a silly one, but…
I’m trying to make a unique system for channel volume control, using dials, so that the movement is slowed down significantly. In theory, I’d like it so that a fast movement of the controlling dial results in the same movement of the volume (which will also be visually represented by another dial) but over the course of maybe 2 seconds. I thought line would be the object to use for this, however I’m not sure how to seperate the initial dial position and the destination in order to make the line function correctly?
Had a quick browse through the reference manual and came out more confused.
Like I say, apologies if this a total pleb question.
thanks a lot
tom


September 12, 2006 | 12:15 pm

- apologies for mulitple posts, I was prompted with server errors, looks like one got through.


September 12, 2006 | 12:18 pm

A simple hack for this may be the [speedlim] object. Or you could try filtering your data based on rate of change. There are a number of 3rd party objects with "delta" in the name that do just this. It also sounds like a simple low-pass filter for your data could do the trick.


September 12, 2006 | 1:35 pm

cool, thanks a lot, played around with [speedlim]…
[speedlim] and a [ggate] did the job, however it gets confused if the controller dial is moved gradually I know I can change the [speedlim] speed via the right inlet, however I then need to find an object that times between the first and last bangs with successive dial movement… any ideas?
attached is the progressive dial movement in text, if anyone’s interested.
please let me know if you have any ideas
cheers
tom


September 12, 2006 | 7:29 pm

I m not shure I undurstood what you want to do, but this might be of interest.

//yac

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 413 220 27 9109513 i;
#P newex 413 168 21 9109513 b 1;
#P comment 395 58 125 9109513 only first and last;
#P newex 413 299 26 9109513 print;
#P user dial 413 250 40 40 128 1 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225
0 0 0 0 0 0;
#P newex 413 193 38 9109513 del 200;
#P comment 456 113 54 9109513 your dial;
#P user dial 413 108 40 40 128 1 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225
0 0 0 0 0 0;
#P comment 100 59 125 9109513 simple line smoothing;
#P comment 186 112 54 9109513 your dial;
#P newex 28 212 27 9109513 + 1;
#P toggle 28 178 15 0;
#P button 28 160 15 0;
#P newex 119 258 34 9109513 gate 2;
#P newex 28 132 38 9109513 sel 49;
#P newex 28 105 40 9109513 key;
#P number 246 159 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 119 295 28 9109513 pack;
#P user dial 119 392 40 40 128 1 0 0 159 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225
0 0 0 0 0 0;
#P number 119 358 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 119 333 40 9109513 line;
#P user dial 143 99 40 40 128 1 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0
0 0 0 0 0;
#P comment 47 160 69 9109513 key 1 trigger;
#P comment 284 159 54 9109513 speed ms;
#P connect 16 0 22 0;
#P connect 16 0 23 1;
#P connect 23 0 19 0;
#P connect 18 0 23 0;
#P connect 22 0 18 0;
#P connect 19 0 20 0;
#P fasten 10 1 3 0 148 326 124 326;
#P connect 6 0 3 0;
#P connect 10 0 6 0;
#P connect 2 0 10 1;
#P fasten 13 0 10 0 33 244 124 244;
#P connect 12 0 13 0;
#P connect 11 0 12 0;
#P connect 9 0 11 0;
#P connect 8 0 9 0;
#P fasten 7 0 6 1 251 289 142 289;
#P connect 4 0 5 0;
#P connect 3 0 4 0;
#P window clipboard copycount 24;


September 13, 2006 | 12:16 am

thanks everyone for your help, I’m very nearly there. Sorry if I didn’t explain myself that well in my initial post, what I’m aiming for is a method of controlling volume quickly, but the outcome being very gradual, for playing out live. I’ve been playing around, I’ve got the mouse side of things working, so when the mouse button is released, the volume will go to the desination slowly. What I’m also trying to achieve is keyboard control, so when a key is triggered, the volume goes from its current position to either minimum or maximum. At the moment the [1] key turns the dial up, and the [q] button down, however I am experiencing problems. When left static, and performing a key trigger, the dial jumps, instead of moves gradually line object, if anyone has any ideas why this might be, I’d be very grateful.
thanks very much
tom

here’s the patch-

max v2;
#N vpatcher 93 44 574 507;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 337 191 14 196617 0;
#P message 216 191 26 196617 127;
#P message 379 191 14 196617 0;
#P newex 337 158 53 196617 t b b b b;
#P newex 337 135 44 196617 sel 113;
#P window linecount 2;
#P comment 214 52 69 196617 key 1 trigger volume up;
#P window linecount 1;
#P newex 216 158 53 196617 t b b b b;
#P message 258 191 26 196617 127;
#P newex 106 215 48 196617 loadbang;
#P message 106 237 34 196617 3000;
#P newex 25 193 27 196617 int;
#P newex 119 156 27 196617 t b i;
#P user dial 60 352 40 40 128 1 0 0 235 270 3 0.414062 241 75 255 221 221 221 120 120 120 225 225 225 255 255 255 0 0 0;
#P newex 60 313 40 196617 line;
#P newex 60 263 57 196617 pack 0 0 0;
#P message 60 290 73 196617 set $1 , $2 $3;
#P newex 42 132 76 196617 speedlim 5000;
#P user dial 119 71 40 40 128 1 0 0 232 270 3 0.328125 249 75 255 221 221 221 120 120 120 225 225 225 255 255 255 0 0 0;
#P newex 119 132 62 196617 mousefilter;
#P newex 216 135 38 196617 sel 49;
#P newex 216 108 40 196617 key;
#P window linecount 3;
#P comment 192 221 59 196617 time to destination (ms);
#P fasten 18 1 11 0 356 185 30 185;
#P fasten 18 2 11 0 370 185 30 185;
#P fasten 15 1 11 0 235 185 30 185;
#P fasten 15 2 11 0 249 185 30 185;
#P fasten 10 0 11 0 124 185 30 185;
#P fasten 4 0 5 0 124 123 47 123;
#P fasten 8 0 11 1 65 344 161 344 161 185 47 185;
#P connect 5 0 11 1;
#P fasten 11 0 7 0 30 218 65 218;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 9 0;
#P fasten 14 0 7 1 263 257 88 257;
#P fasten 19 0 7 1 384 257 88 257;
#P fasten 10 1 7 1 141 209 88 209;
#P connect 13 0 12 0;
#P connect 12 0 7 2;
#P fasten 12 0 5 1 111 257 185 257 185 123 113 123;
#P fasten 21 0 4 0 197 206 197 52 124 52;
#P fasten 20 0 4 0 197 206 197 52 124 52;
#P connect 4 0 3 0;
#P connect 3 0 10 0;
#P connect 1 0 2 0;
#P connect 2 0 15 0;
#P connect 15 0 20 0;
#P connect 15 3 14 0;
#P fasten 1 0 17 0 221 130 342 130;
#P connect 17 0 18 0;
#P connect 18 0 21 0;
#P connect 18 3 19 0;
#P pop;


September 16, 2006 | 6:45 am

register wrote:
> When left static, and performing a key trigger, the dial jumps,
> instead of moves gradually line object, if anyone has any ideas why
> this might be, I’d be very grateful. thanks very much tom

After 3 seconds, jump and destination are the same…

I have attached my version including a "firstlast" abhaXion. This has a
middle outlet which shows the direction of the move before you know the
end… You might want to have a constant speed instead of a given time
to reach your destination…

#P window setfont "Sans Serif" 9.;
#P number 96 174 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 187 173 22 196617 t 0;
#P newex 152 130 50 196617 key;
#P newex 152 173 33 196617 t 127;
#P newex 152 152 81 196617 sel 49 113;
#P newex 26 199 80 196617 pack 0 3000;
#P user hslider 26 251 18 128 128 1 0 0;
#P newex 26 222 50 196617 line;
#P number 94 72 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 30 89 342 469;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 80 141 27 196617 gate;
#P outlet 80 260 15 0;
#P newex 80 212 27 196617 t -1;
#P newex 80 191 34 196617 sel 0;
#P newex 80 169 34 196617 > 0.;
#P newex 80 238 38 196617 change;
#P inlet 168 46 15 0;
#P newex 109 111 38 196617 t 1 0 b;
#P outlet 51 260 15 0;
#P newex 51 141 27 196617 gate;
#P outlet 137 260 15 0;
#P newex 51 69 68 196617 t 0 1 b;
#P inlet 51 46 15 0;
#P newex 109 90 69 196617 delay 300;
#P newex 137 141 36 196617 int;
#P connect 2 0 3 0;
#P fasten 7 0 5 0 114 132 56 132;
#P connect 3 0 5 0;
#P connect 5 0 6 0;
#P fasten 2 0 5 1 56 65 73 65;
#P fasten 7 1 14 0 128 137 85 137;
#P connect 3 1 14 0;
#P connect 14 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 9 0;
#P fasten 11 1 9 0 109 233 85 233;
#P connect 9 0 13 0;
#P fasten 2 0 14 1 56 65 102 65;
#P fasten 5 0 10 1 56 163 109 163;
#P connect 3 2 1 0;
#P connect 1 0 7 0;
#P connect 7 2 0 0;
#P connect 0 0 4 0;
#P fasten 2 0 0 1 56 65 168 65;
#P connect 8 0 1 1;
#P pop;
#P newobj 27 96 77 196617 p firstlast 300;
#P number 60 120 29 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 93 152 55 196617 print last;
#P newex 27 152 55 196617 print first;
#P user hslider 27 48 18 128 128 1 0 0;
#P window linecount 7;
#P comment 203 36 100 196617 report the first , and the last within a
given time. The middle outlet will give the direction of change relative
to the first value.;
#P window linecount 1;
#P comment 112 90 74 196617 timing interval;
#P connect 15 0 10 1;
#P connect 11 0 12 0;
#P fasten 12 0 10 0 157 194 31 194;
#P fasten 14 0 10 0 192 194 31 194;
#P connect 11 1 14 0;
#P connect 13 0 11 0;
#P connect 6 2 10 0;
#P connect 6 2 4 0;
#P connect 8 0 9 0;
#P connect 10 0 8 0;
#P connect 7 0 6 1;
#P connect 6 0 3 0;
#P connect 6 1 5 0;
#P connect 2 0 6 0;
#P window clipboard copycount 16;


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


September 16, 2006 | 11:08 am

Quote: Tom Haig wrote on Tue, 12 September 2006 06:14
—————————————————-
> however I’m not sure how to seperate the initial dial position and the destination in order to make the line function correctly?

> tom
—————————————————-

there are many ways to do this, but maybe you could
make a system which adds and substracts +1 +1 +1 and
so on instead of sending absolute gain values from your
dials – and then use [limit] to slow incoing
values from the GUI control down – does about what a
line would do. :)

-110


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