Assigning Analog Thumbstick Values to Sample Speed

Jun 5, 2007 at 2:03pm

Assigning Analog Thumbstick Values to Sample Speed

Hi everyone,
I’ve been tring for a while now to get this to work to no avail. Hopefully, somebody out there will be able to help.

I am attempting to create a basic loop sampler which can be controlled via a PS2 style controller. The buttons 1-4 will control sample banks, the triggers will hopefully control tempo whilst the thumbsticks will act as turntables. I want to be able to use the analog-thumbsticks to speed up/slow down the samples (similar to that of a turntable effect when you drag the vinyl back and forth). My problem is this, when I move the thumbsticks about I am given a lot of different values, and these seem to change everytime I move the thumbsticks depending on how fast/slow I move them. I have been trying for ages to figure out a way in which I can assign these values to affect the speed but everytime I try to do so, the speed of the sample speeds up/slows down in increments that are way too much.
I hope this made sense, and I really hope somebody out there understands what it is i’m trying to achieve and has some answers. I am a desperate man and any help is greatly appreciated.

Thanks.

#32272
Jun 5, 2007 at 4:10pm

as far as im able to understand youll yust have to divide the output value by a more pleasant interval.. maybe useing something like route to strip ids n stuff

grtz

#105847
Jun 5, 2007 at 4:20pm

the thing is, you get a range from 0 to 127 becouse thats one byte.
and 127 is the maximum number of bit configurations in one byte.

#105848
Jun 5, 2007 at 4:36pm

Quote: Renoir wrote on Tue, 05 June 2007 08:03
—————————————————-
I am a desperate man and any help is greatly appreciated.
>
> Thanks.
—————————————————-

I like the “desperate man” part.
I assume that you have a joystick being read out by an HI-boject. Just scale it: [scale 0 32000 0. 2.] (you have to replace 32000 with whatever the maximum output of your joystick is and 2. with whatever value you want to get. You probably want it to go back and forth: [scale -32000 32000 -2. 2.]
Don’t forget the periods after the output numbers.

The thumbsticks each send out two values: x and y. You have to separate them in the datastream from HI by using [unpack]

#105849
Jun 5, 2007 at 4:44pm

Hi Jamie,

Can you post a patch? You’ll get much more helpful answers if people can
see what you’ve done.


Owen

Jamie Bignell wrote:
> Hi everyone, I’ve been tring for a while now to get this to work to
> no avail. Hopefully, somebody out there will be able to help.

#105850
Jun 5, 2007 at 4:44pm

Hi guys,
thanks for the replies. This is where I’m getting confused I think. Originally I was of the impression that only 0-127 can be assigned to perform certain actions. Whereas when I move the thumbsticks about, the Max window shows the following attachment:

In the .jpeg you can see that by moving the thumbstick from center to left, back to center, then to right and finally back to center again it kicks out all of these values. I just have no idea as to how those values can be assigned to control the speed of a sample. Another problem is that when I repeat these movements, the resulting values change slightly depending on the speed of the thumbstick movement….the faster I move them, the less values etc.

I’m really confused about the whole thing and am not really sure of what I should be looking at.

#105851
Jun 5, 2007 at 4:48pm

Hi Lukas,

To be pedantic, 0..127 is 7-bit resolution, not one byte (normally
understood as 8 bits). As it is, the OP didn’t provide enough
information to know whether this is a scaling problem or not.


Owen

lukas wrote:
> the thing is, you get a range from 0 to 127 becouse thats one byte.
> and 127 is the maximum number of bit configurations in one byte.

#105852
Jun 5, 2007 at 4:50pm

Hi again…I will post a patch I have just started again from scratch…as my last one was such a mess. Be warned…it’s basic….and you’ll have to add your own sample.

Thanks again.

#105853
Jun 5, 2007 at 5:21pm

To get a basic understanding of working with the HI input of MaxMSP,
please read this article:

http://www.cycling74.com/story/2007/3/12/113645/135

If you are still confused after reading that, come back and ask more
questions. Be sure to provide a simple patch that shows what you are up to.

Best,
Andrew B.

#105854
Jun 5, 2007 at 5:24pm

Jamie Bignell wrote:
> Hi guys, thanks for the replies. This is where I’m getting confused
> I think. Originally I was of the impression that only 0-127 can be
> assigned to perform certain actions. Whereas when I move the
> thumbsticks about, the Max window shows the following attachment:

Nothing special about 0..127, just a hangover from MIDI. The numbers in
your screenshot suggest that you’ve got data in the range 0..65535,
which is 16 bits. You can use [scale] to map this to a more desirable
range.

Problems of variability, over-sensitivity, jitter and so forth can be
overcome with some sort of smoothing, e.g. with [slide].

I’ll look at your patch once I’ve had me tea.


Owen

#105855
Jun 5, 2007 at 6:42pm

1byte = 8bits ;)

#105856
Jun 5, 2007 at 6:49pm

Hi, and thanks again for the replies. I had seen that article before andrewb and I get the jist of it for the most part. My only real issue (at the moment) is turning the values from the thumbsticks into something that easier translates to speed-of-sample. I’ll check out the [scale] object as a couple of people have suggested to do so. As you can surely tell, I am a complete noob and find a lot of the numerical data somewhat hard to grasp at times. I will get it in the end.

Thanks again.

P.S. I was planning on using the trigger buttons on the control pad to move up and down BPM. I’m sure it has something to do with tempo. My question though, is this:

Will using these triggers as BPM step-up/down controllers in any way interfere with what I will have going on with the thumbstick controls?

#105857
Jun 5, 2007 at 6:54pm

yeah yust divide by more.
it`s yust a resolution increase by the power of 8.
so you got a controller thats more sensetive than yr
average midi control.

no problem i think.. cheers

#105858
Jun 5, 2007 at 7:12pm

funny though.

pitchbending things with it would be the
professionals choice:)

enjoy

#105859
Jun 5, 2007 at 7:42pm

Hi lukhasj,
it’s funny you should mention pitch-bending, as this was my initial thought. Is this just as easy to do? Also, how would I go about doing it? hehe

Thanks,
Jamie.

#105860
Jun 5, 2007 at 8:38pm

if you change the speed of your wave player the pitch changes.
if that is what you ment??

#105861
Jun 5, 2007 at 8:53pm

Well….basically… I am trying to make a patch that acts as a loop sampler and can be controlled via a PS2 style controller.

The left and right bumper buttons will control the sample playing for each side. Left bumper starts and stops a sample which will be controlled via the left thumb-stick and vice versa.

The left and right triggers will control the BPM by shifting it up or down by one at a time.

Buttons one, two, three and four (the standard four-button array)will act as sample banks.

The left and right thumbstick should act as the left and right turntable. Therefore, I would need the thumbsticks to manipulate the samples playing on each side. To create the vinyl-like effect of dragging/scratching/rewinging/flicking on, I am assuming that I will need to use the thumbsticks to alter the sample speed?

I hope this makes sense…that’s pretty much my whole idea in a really basic explaination.

Yet again, any help is much appreciated…for I am indeed…a desperate man.

#105862
Jun 8, 2007 at 12:18pm

Hi guys…

I’m still having no joy whatsoever assigning the values from my analog thumbsticks from the PS2 controller to affecting audio.

I am able to manipulate the audio with the thumbstick by using the [scale] function. It just doesn’t work in the way I need it to work.

When I rotate the thumbstick, I want the audio to act as though it is a vinyl being manually moved round. So essentially, rotating a thumbstick backwards would have a rewind like effect. The faster you rotate, the faster (higher pitched) the audio sample gets and vice-versa. I also want to be able to use the thumbsticks to “scratch” audio.

Can anybody out there help me?

I just don’t have a clue at this point in time…

#105863
Jun 8, 2007 at 12:33pm

check out the object :

[waveform~] , combine it with groove~ , also zigzag~ might be a nice place to start. Check the scrub sampler in the examples and modify it to control parts with your joystick!

The goal you set is reachable, just experiment with the examples and try to get your plan thought through!

good luck.

#105864
Jun 8, 2007 at 12:43pm

Thanks for the reply….i’ll check them out now.

#105865
Jun 8, 2007 at 1:13pm

Jamie skrev:
> Hi guys…
> …
> When I rotate the thumbstick, I want the audio to act as though it is a vinyl being manually moved round. So essentially, rotating a thumbstick backwards would have a rewind like effect.
This is the main problem: The thumbsticks aren’t made to be rotated,
they act as an X/Y coordinate – that is perhaps why you
have been confused by the numbers you are seeing?

The easiest thing to set up would be to make the effect when moving the
thumbstick up/down or left/right, not in a circle. IF you absolutely
NEED to move them in a circle you should look at the [cartopol] and
[poltocar] objects, which will turn the X/Y into Angle and Distance…
but there would be some math involved, and you’d still need to scale
your inputs.

Andreas.

#105866
Jun 8, 2007 at 1:24pm

Thanks for the reply.

That’s pretty much how I have been trying to think of it, since the rotation thing hasn’t worked so far.

So basically….I’ll have:

Two soundbanks (left and right shoulder buttons)

Uptempo and downtempro (left and right trigger buttons)

Music loops for right-thumbstick (buttons 2 and 4, from the 1-4 array)

Samples for scratching with via the left-thumbstick (buttons 1 and 3, from the 1-4 array)

Whilst I want the right-thumbstick to have some (mild) controls over the music loops, the left thumbstick will be used to scratch short samples over the top.

Thing is, i’ve tried the left-right and top-bottom things before, but I just can’t get it to feel responsive enough to scratch anything worth listening to. Would this be an issue because the scratch sample is on a loop? Should I be triggering these sounds if and when I interact with the thrumbstick?

#105867
Jun 8, 2007 at 2:21pm

Jamie skrev:
> I just can’t get it to feel responsive enough to scratch anything worth listening to.
That could be because of a number of different factors, which I can’t
know without hearing a sample or seeing a patch in person (with the
relevant controller, etc.). You might need smoothing on the control
values from the stick, or you may need to treat the audio differently.
Also, you would need a way to cut the sample too, since simply going
back and forth over a sound is very 80s.

Andreas.

#105868
Jun 8, 2007 at 2:22pm

As my audio files were originally in a loop, I now have the problem of making it work so that the sample only starts when triggered and stops when left alone.

So basically, as the thumbstick is pushed upward, the sample starts. As the thumbstick is returned to the center position I want the sample to stop.

#105869
Jun 8, 2007 at 2:27pm

hmmm…Good point. Perhaps I could make it so that the right trigger acts as a mute for the right thumbstick? This would mean that I’d have to alter the tempo/bpm some other way.

#105870
Jun 8, 2007 at 2:32pm

Would there be a way in which I can use the 128 value from the trigger to move volume to zero whilst the 0 value of the trigger moves the volume back up to say 115? This would act as a ducking system as the value of 0 occurs automatically when the trigger is release.

#105871
Jun 8, 2007 at 3:20pm

ok…so I now have the trigger acting as a cutoff button, and when it is released the volume goes back to normal (115). Now I have to work on the sample manipulation for the right thumbstick. As at the moment, it just kinda cuts in, as opposed to speeding up/slowing down with movement.

#105872
Jun 8, 2007 at 11:17pm

Hi everyone.

Is there anybody out there who can tell me where i’m going wrong with this patch?

It’s a simple idea, but what a nightmare it’s become. I want to use the right-thumbstick just the way it works at the moment.

In addition to this, I want the left thumbstick to have a small amount of control over the four loops that will be assigned to the four buttons (eg. w,x,y,z). I want two sound banks each with four sounds in…one for left stick, one for right.

I added the first of my samples for the four buttons, now ehenever I play the sound assigned to the right thumbstick, it distorts. But! When it is played at the same time as the newly added sample….it plays fine….what the hell?!?!

Hopefully somebody out there will be able to understand what I mean. Sometimes I confuse myself…hehe.

Thanks in advance.

Jamie.

P.S. I have uploaded my mess-of-a-patch (laugh if you must at it’s simplicity)

#105873
Jun 8, 2007 at 11:28pm

If you must attach a patch to a forum post, please do it as a .zip file.
Max patcher files tend to get corrupted. Otherwise, it is generally
preferred to copy and paste the patch as text into the body of your post.

AB

http://www.cycling74.com/twiki/bin/view/FAQs/BeginnersFAQ

#105874
Jun 8, 2007 at 11:54pm

ok thanks, I will bare that in mind for the future.

#105875
Jun 9, 2007 at 10:15am

Jamie skrev:
> Hi everyone.
>
> Is there anybody out there who can tell me where i’m going wrong with this patch?
>
> It’s a simple idea, but what a nightmare it’s become. I want to use the right-thumbstick just the way it works at the moment.
>
How does it work at the moment?
> In addition to this, I want the left thumbstick to have a small amount of control over the four loops that will be assigned to the four buttons (eg. w,x,y,z).
What kind of “small amount of control”?
> I want two sound banks each with four sounds in…one for left stick, one for right.
>
> I added the first of my samples for the four buttons, now ehenever I play the sound assigned to the right thumbstick, it distorts. But! When it is played at the same time as the newly added sample….it plays fine….what the hell?!?!
>
that’s what I thought, too
> Hopefully somebody out there will be able to understand what I mean. Sometimes I confuse myself…hehe.
I can imagine, with that total lack of cable hygiene…

I took the liberty of unravelling a bit of it, see if this still works
like the other one, and I can try to work out what’s wrong from here.

Andreas

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 72 235 45 9109513 loadbang;
#P window linecount 2;
#P newex 430 352 48 9109513 groove~ sample1;
#B color 5;
#P toggle 403 302 15 0;
#P window linecount 1;
#P newex 403 323 25 9109513 sig~;
#P newex 443 323 28 9109513 sel 0;
#P newex 481 145 136 9109513 buffer~ sample1 Sample1.wav;
#P message 481 106 38 9109513 replace;
#P button 268 260 27 0;
#P user led 304 235 17 17 2 150;
#P user led 167 260 17 17 2 150;
#P newex 167 235 46 9109513 sel 18000;
#P newex 119 235 46 9109513 sel -1;
#P newex 119 199 42 9109513 route 32;
#P comment 475 317 108 9109513 Assigned to Buttons 1-4;
#B color 12;
#P user led 500 298 17 17 3 150;
#P user led 481 298 17 17 2 150;
#P user led 462 298 17 17 1 150;
#P user led 443 298 17 17 0 150;
#P newex 444 199 81 9109513 route 48 49 50 51;
#P window linecount 2;
#P comment 120 315 93 9109513 Right Trigger acts as sample start/stop;
#B color 12;
#P window linecount 1;
#P newex 262 235 38 9109513 sel 128;
#P newex 216 235 38 9109513 sel 0;
#P message 216 320 29 9109513 stop;
#P newex 343 235 88 9109513 scale 30463 0 0. 1.;
#P message 186 259 13 9109513 0;
#P user umenu 263 125 100 9109543 1 64 141 1;
#X add SpaceNavigator;
#P user gain~ 296 432 24 100 158 0 1.071519 7.94321 10.;
#P user levelmeter~ 311 565 188 94 20 0 0 0 -48 12 0 0 0 0 0;
#X brgb 172 172 255;
#X frgb 132 132 215;
#X rgb2 0 0 0;
#X rgb3 0 0 0;
#X rgb4 0 0 0;
#X rgb5 255 0 0;
#X rgb6 220 100 100;
#X rgb7 220 150 80;
#X rgb8 220 200 100;
#X rgb9 180 210 100;
#X markers 12 6 0 -6 -12 -24 -36 -48 71123536;
#X markersused 8;
#X done;
#P newex 232 199 71 9109513 route 8 20 55 8;
#P number 304 174 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 260 174 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 260 151 54 9109513 unpack 0 0;
#P newex 193 150 36 9109513 print hi;
#P newex 232 122 27 9109513 hi;
#P message 241 91 36 9109513 poll 0;
#P message 278 91 35 9109513 poll 10;
#P button 278 67 16 0;
#P message 242 66 31 9109513 menu;
#P newex 311 362 36 9109513 sig~ 1.;
#P flonum 311 342 81 9 0 0 0 139 0 0 0 221 221 221 0 0 0 0 0 0;
#P newex 376 144 90 9109513 buffer~ spool 500 2;
#P message 376 105 38 9109513 replace;
#P toggle 221 517 34 0;
#P newex 261 582 45 9109513 dac~;
#P user gain~ 261 432 24 100 158 0 1.071519 7.94321 10.;
#P newex 286 293 45 9109513 loadbang;
#P message 119 261 23 9109513 115;
#P message 311 321 14 9109513 1;
#P message 261 320 44 9109513 startloop;
#P comment 324 321 68 9109513 Speed Control;
#B color 12;
#P comment 319 534 70 9109513 Stereo Volume;
#B color 12;
#P comment 413 105 65 9109513 Load Sample;
#B color 12;
#P comment 153 517 67 9109513 Turn On Audio;
#B color 12;
#P newex 261 386 106 9109513 grooveduck2 spool 1;
#P window linecount 2;
#P comment 298 262 52 9109513 Load Loop Sampler;
#B frgb 57 225 0;
#P window linecount 1;
#P comment 210 604 95 9109513 Sound Card Settings;
#B color 12;
#P window linecount 2;
#P comment 17 262 100 9109513 D-Pad acts as a volume cut-off;
#B color 12;
#P window linecount 1;
#P newex 424 397 64 9109513 dac~;
#B color 5;
#P fasten 24 0 45 0 237 193 124 193;
#P connect 45 0 46 0;
#P connect 46 0 11 0;
#P fasten 57 0 11 0 77 257 124 257;
#P fasten 45 0 47 0 124 232 172 232;
#P connect 47 0 48 0;
#P fasten 47 0 33 0 172 257 191 257;
#P fasten 24 0 25 0 237 147 198 147;
#P fasten 29 2 36 0 267 226 221 226;
#P connect 36 0 35 0;
#P fasten 20 0 24 0 247 83 237 83;
#P fasten 21 0 24 0 283 83 237 83;
#P fasten 22 0 24 0 283 108 237 108;
#P fasten 23 0 24 0 246 108 237 108;
#P fasten 32 1 24 0 358 115 237 115;
#P fasten 24 0 29 0 237 193 237 193;
#P fasten 24 0 26 0 237 147 265 147;
#P fasten 26 0 27 0 265 170 265 170;
#P fasten 12 0 9 0 291 316 266 316;
#P connect 37 0 9 0;
#P fasten 19 0 4 0 316 383 266 383;
#P connect 9 0 4 0;
#P fasten 35 0 4 0 221 361 266 361;
#P fasten 11 0 13 0 124 428 266 428;
#P connect 4 0 13 0;
#P fasten 33 0 13 0 191 428 266 428;
#P fasten 13 0 14 0 266 557 266 557;
#P connect 15 0 14 0;
#P fasten 29 2 37 0 267 222 267 222;
#P fasten 24 1 32 0 254 118 268 118;
#P fasten 50 0 12 0 273 290 291 290;
#P connect 13 1 31 0;
#P fasten 4 1 31 0 314 418 301 418;
#P connect 31 0 14 1;
#P fasten 26 1 28 0 309 170 309 170;
#P fasten 29 2 49 0 267 229 309 229;
#P fasten 12 0 10 0 291 316 316 316;
#P fasten 34 0 18 0 348 339 316 339;
#P connect 10 0 18 0;
#P connect 18 0 19 0;
#P connect 13 0 30 0;
#P connect 31 0 30 0;
#P fasten 29 3 34 0 282 223 348 223;
#P connect 16 0 17 0;
#P fasten 55 0 54 0 408 317 408 317;
#P fasten 56 0 0 0 435 390 429 390;
#P fasten 53 1 56 0 466 347 435 347;
#P fasten 54 0 56 0 408 347 435 347;
#P fasten 39 0 40 0 449 289 448 289;
#P connect 40 0 53 0;
#P fasten 24 0 39 0 237 193 449 193;
#P fasten 39 1 41 0 466 289 467 289;
#P fasten 56 1 0 1 473 390 483 390;
#P connect 51 0 52 0;
#P fasten 39 2 42 0 483 289 486 289;
#P fasten 39 3 43 0 500 289 505 289;
#P window clipboard copycount 58;

#105876
Jun 9, 2007 at 1:22pm

Hi there…I will try that as soon as I get back from work. Thanks for replying.

P.S. Cable hygiene???

#105877
Jun 9, 2007 at 1:28pm

Hi again…sorry, forgot to answer your questions.

Q: How does it work at the moment?

A: With the right thumbstick (combined with down on the d-pad and the right trigger) I am able to manipulate the audio samples by speed/pitch, cutting the volume in and out and start/stopping the sample. This is fine and i’d like to leave this as is.

Q: What kind of “small amount of control”?

A: As far as the left thumbstick is concerned, all I want to be able to do is drag the stick down to pause the audio….just to achieve the kind of effect you would get when pressing the stop button on the turntable.

P.S. I have only been using Max/MSP for a couple of months (on and off) so please bare with me. Also, how do I convert those lines of code into a tangible file that I can open with Flash?

Thanks again.

Jamie.

#105878
Jun 10, 2007 at 3:33pm

Hi guys. I’ve started yet another patch in an attempt to make this work. So far I like the way it’s functioning and the only thing I really need to know (at the moment) is how to use a single button (when the thumbstick is clicked) to flick between four different samples.

I have so far managed to use the gate which allows me to choose between two, but I need to be able to choose between four.

Does anybody know of a way?

I have posted my patch (in text format this time) below:

max v2;
#N vpatcher 81 69 1251 952;
#P origin 0 98;
#P inlet 649 530 15 0;
#P user gswitch 862 698 41 32 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 968 524 38 9109513 sel 128;
#P newex 917 525 38 9109513 sel 0;
#P number 976 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 932 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 964 566 15 0;
#P button 908 558 15 0;
#P newex 991 394 38 9109513 sel 128;
#P newex 949 391 38 9109513 sel 0;
#P user gswitch 964 441 41 32 1 0;
#P toggle 968 356 15 0;
#P comment 196 231 156 9109513 Left Thumbstick for Rewinds;
#B color 12;
#P newex 196 253 91 9109513 scale 65535 0 -3. 1.;
#P flonum 196 279 81 9 0 0 0 139 0 0 0 221 221 221 0 0 0 0 0 0;
#P comment 783 35 125 9109513 RIGHT DECK;
#B frgb 57 225 0;
#P toggle 881 448 15 0;
#P message 881 473 41 9109513 loop $1;
#P window linecount 2;
#P comment 760 390 100 9109513 Right Trigger acts assample start/stop;
#B color 12;
#P window linecount 1;
#P newex 722 389 38 9109513 sel 128;
#P newex 722 414 38 9109513 sel 0;
#P newex 822 364 111 9109513 scale 65535 30463 -1. 1.;
#P message 686 457 30 9109513 stop;
#P newex 804 493 36 9109513 sig~ 1.;
#P flonum 793 462 81 9 0 0 0 139 0 0 0 221 221 221 0 0 0 0 0 0;
#P message 804 428 14 9109513 1;
#P message 718 457 44 9109513 startloop;
#P comment 817 428 68 9109513 Speed Control;
#B color 12;
#P newex 886 320 76 9109513 route 8 20 54 59;
#P user led 153 407 17 17 4 150;
#P user led 153 386 17 17 4 150;
#P user led 153 365 17 17 4 150;
#P message 171 365 26 9109513 1.15;
#P newex 788 230 101 9109513 buffer~ scratch4 2000;
#B color 15;
#P message 788 207 42 9109513 replace;
#P newex 788 182 101 9109513 buffer~ scratch3 2000;
#B color 15;
#P message 788 159 42 9109513 replace;
#P newex 788 134 101 9109513 buffer~ scratch2 2000;
#B color 15;
#P message 788 111 42 9109513 replace;
#P newex 769 686 29 9109513 dac~;
#P message 973 596 60 9109513 set scratch4;
#P message 910 596 60 9109513 set scratch3;
#P message 847 596 60 9109513 set scratch2;
#P message 784 596 60 9109513 set scratch1;
#P newex 769 637 76 9109513 groove~ scratch;
#P newex 788 87 101 9109513 buffer~ scratch1 2000;
#B color 15;
#P message 788 64 42 9109513 replace;
#P button 289 433 15 0;
#P button 267 433 15 0;
#P newex 37 311 87 9109513 buffer~ loop4 2000;
#B color 15;
#P message 37 288 42 9109513 replace;
#P newex 37 263 87 9109513 buffer~ loop3 2000;
#B color 15;
#P message 37 240 42 9109513 replace;
#P message 490 553 46 9109513 set loop4;
#P message 442 553 46 9109513 set loop3;
#P newex 506 442 28 9109513 sel 0;
#P newex 474 442 28 9109513 sel 0;
#P user umenu 535 242 100 9109543 1 64 258 1;
#X add “USB Joystick “;
#P number 464 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 420 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 420 277 54 9109513 unpack 0 0;
#P newex 454 216 36 9109513 print hi;
#P newex 410 199 27 9109513 hi;
#P message 446 154 36 9109513 poll 0;
#P message 485 154 35 9109513 poll 10;
#P button 453 98 16 0;
#P message 420 71 31 9109513 menu;
#P comment 412 37 125 9109513 LEFT DECK;
#B frgb 57 225 0;
#P comment 477 68 67 9109513 1. Click Menu;
#B color 12;
#P comment 477 85 225 9109513 2. Select USB Joystick from Drop-Down Menu;
#B color 12;
#P comment 477 102 191 9109513 3. Click ‘Poll 10′ To Send Controller Values;
#B color 12;
#P comment 561 362 156 9109513 Assigned to Buttons 1-4;
#B color 12;
#P user led 481 405 17 17 3 150;
#P user led 462 405 17 17 2 150;
#P user led 443 405 17 17 1 150;
#P user led 424 405 17 17 0 150;
#P newex 424 362 136 9109513 route 48 49 50 51 53 55 57 0 4;
#P newex 443 442 28 9109513 sel 0;
#P newex 410 442 28 9109513 sel 0;
#P button 246 433 15 0;
#P button 224 433 15 0;
#P message 394 553 46 9109513 set loop2;
#P message 346 553 46 9109513 set loop1;
#P newex 37 215 87 9109513 buffer~ loop2 2000;
#B color 15;
#P message 37 192 42 9109513 replace;
#P user ezdac~ 50 817 94 850 0;
#P toggle 233 674 15 0;
#P message 335 715 41 9109513 set loop;
#P user waveform~ 346 793 200 74 139 9;
#W mode select;
#W mouseoutput continuous;
#W unit ms;
#W grid 1000.;
#W ticks 0;
#W labels 1;
#W vlabels 0;
#W vticks 1;
#W bpm 120. 4.;
#W frgb 33 0 0;
#W brgb 60 178 173;
#W rgb2 0 95 255;
#W rgb3 0 0 0;
#W rgb4 0 0 0;
#W rgb5 190 137 255;
#W rgb6 100 100 100;
#W rgb7 100 100 100;
#P newex 37 166 87 9109513 buffer~ loop1 2000;
#B color 15;
#P newex 61 89 44 9109513 groove~;
#P newex 61 65 44 9109513 buffer~;
#P message 37 143 42 9109513 replace;
#P message 113 587 49 9109513 startloop;
#P message 116 546 27 9109513 stop;
#P message 197 671 27 9109513 stop;
#P message 128 671 65 9109513 startwindow;
#P message 171 407 26 9109513 0.9;
#P message 171 386 14 9109513 1;
#P toggle 332 421 15 0;
#P message 332 446 41 9109513 loop $1;
#P flonum 376 609 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 251 704 29 9109513 dac~;
#P hidden toggle 162 288 15 0;
#P newex 259 579 27 9109513 sig~;
#P newex 251 635 261 9109513 groove~ hitme;
#B color 5;
#P window linecount 2;
#P comment 171 335 100 9109513 Speed Control for Loops;
#B color 12;
#P connect 14 0 17 0;
#P connect 22 0 23 0;
#P connect 54 0 55 0;
#P connect 56 0 57 0;
#P hidden connect 30 5 75 0;
#P hidden connect 30 6 76 0;
#P hidden connect 30 4 77 0;
#P hidden connect 75 0 74 0;
#P hidden connect 30 6 8 0;
#P hidden connect 76 0 8 0;
#P hidden connect 77 0 9 0;
#P connect 30 8 93 0;
#P fasten 93 0 92 0 201 271 201 271;
#P fasten 53 0 1 0 495 602 256 602;
#P fasten 52 0 1 0 447 602 256 602;
#P fasten 25 0 1 0 399 602 256 602;
#P fasten 24 0 1 0 351 602 256 602;
#P connect 2 0 1 0;
#P hidden fasten 6 0 1 0 337 594 256 594;
#P hidden fasten 12 0 1 0 121 581 256 581;
#P hidden fasten 13 0 1 0 118 619 256 619;
#P connect 1 0 4 0;
#P fasten 10 0 4 0 133 699 256 699;
#P fasten 11 0 4 0 202 699 256 699;
#P connect 20 0 4 0;
#P fasten 92 0 2 0 201 578 264 578;
#P hidden fasten 74 0 2 0 176 519 264 519;
#P hidden fasten 3 0 2 0 167 511 264 511;
#P hidden fasten 8 0 2 0 176 535 264 535;
#P hidden fasten 9 0 2 0 176 527 264 527;
#P connect 1 0 4 1;
#P connect 7 0 6 0;
#P fasten 26 0 24 0 229 497 351 497;
#P fasten 28 0 24 0 415 489 351 489;
#P fasten 53 0 18 0 495 681 351 681;
#P fasten 52 0 18 0 447 681 351 681;
#P fasten 25 0 18 0 399 681 351 681;
#P fasten 24 0 18 0 351 681 351 681;
#P connect 19 0 18 0;
#P connect 18 2 5 0;
#P connect 5 0 1 1;
#P fasten 27 0 25 0 251 482 399 482;
#P fasten 29 0 25 0 448 489 399 489;
#P fasten 49 1 44 0 630 191 415 191;
#P fasten 43 0 44 0 451 176 415 176;
#P fasten 42 0 44 0 490 183 415 183;
#P fasten 41 0 44 0 458 139 415 139;
#P fasten 40 0 44 0 425 145 415 145;
#P connect 31 0 28 0;
#P fasten 44 0 46 0 415 233 425 233;
#P fasten 46 0 47 0 425 304 425 304;
#P fasten 44 0 30 0 415 346 429 346;
#P fasten 30 0 31 0 429 393 429 393;
#P fasten 50 0 52 0 479 489 447 489;
#P fasten 58 0 52 0 272 482 447 482;
#P fasten 30 1 32 0 446 393 448 393;
#P connect 32 0 29 0;
#P fasten 44 0 45 0 415 215 459 215;
#P fasten 30 2 33 0 463 393 467 393;
#P connect 46 1 48 0;
#P connect 33 0 50 0;
#P fasten 30 3 34 0 480 394 486 394;
#P fasten 51 0 53 0 511 489 495 489;
#P fasten 59 0 53 0 294 482 495 482;
#P connect 34 0 51 0;
#P fasten 44 1 49 0 432 238 540 238;
#P connect 86 0 84 0;
#P connect 87 0 80 0;
#P fasten 78 2 87 0 925 351 727 351;
#P fasten 78 2 86 0 925 357 727 357;
#P fasten 66 0 62 0 978 625 774 625;
#P fasten 65 0 62 0 915 625 774 625;
#P fasten 64 0 62 0 852 625 774 625;
#P fasten 63 0 62 0 789 625 774 625;
#P fasten 89 0 62 0 886 563 774 563;
#P fasten 83 0 62 0 809 574 774 574;
#P fasten 80 0 62 0 723 555 774 555;
#P fasten 84 0 62 0 691 555 774 555;
#P connect 62 0 67 0;
#P connect 99 0 63 0;
#P connect 60 0 61 0;
#P connect 68 0 69 0;
#P connect 70 0 71 0;
#P connect 72 0 73 0;
#P connect 62 0 67 1;
#P fasten 85 0 82 0 827 422 798 422;
#P fasten 81 0 82 0 809 453 798 453;
#P fasten 82 0 83 0 798 485 809 485;
#P fasten 78 0 85 0 891 351 827 351;
#P connect 90 0 89 0;
#P fasten 44 0 78 0 415 269 891 269;
#P connect 103 0 99 0;
#P connect 100 0 65 0;
#P connect 101 0 103 0;
#P connect 96 0 101 0;
#P connect 95 0 97 0;
#P connect 97 0 96 0;
#P connect 104 0 100 0;
#P connect 78 3 95 0;
#P connect 102 0 104 0;
#P connect 96 0 102 0;
#P connect 97 1 96 1;
#P connect 95 0 98 0;
#P connect 98 1 96 2;
#P pop;

Hope somebody will get back to me.

Thanks in advance if you do, I appreciate it.

Jamie.

#105879
Jun 10, 2007 at 3:42pm

Hi there….it took me a while but I finally figured out how to open the text as a patch. Thanks for doing that, the distortion issue seems to be resolved which is great. You also made it hella neat as opposed to my scruffiness…which I appreciated hehe.

Thanks.

Jamie.

#105880
Jun 10, 2007 at 11:49pm

Re: the math of converting x/y into rotation, cartopol (cartesian to
polar) will do it.

On Jun 10, 2007, at 11:33 AM, Jamie wrote:

>
> Hi guys. I’ve started yet another patch in an attempt to make this
> work. So far I like the way it’s functioning and the only thing I
> really need to know (at the moment) is how to use a single button
> (when the thumbstick is clicked) to flick between four different
> samples.
>
> I have so far managed to use the gate which allows me to choose
> between two, but I need to be able to choose between four.
>
> Does anybody know of a way?
>
> I have posted my patch (in text format this time) below:
>
> max v2;
> #N vpatcher 81 69 1251 952;
> #P origin 0 98;
> #P inlet 649 530 15 0;
> #P user gswitch 862 698 41 32 0 0;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P newex 968 524 38 9109513 sel 128;
> #P newex 917 525 38 9109513 sel 0;
> #P number 976 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 932 498 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P button 964 566 15 0;
> #P button 908 558 15 0;
> #P newex 991 394 38 9109513 sel 128;
> #P newex 949 391 38 9109513 sel 0;
> #P user gswitch 964 441 41 32 1 0;
> #P toggle 968 356 15 0;
> #P comment 196 231 156 9109513 Left Thumbstick for Rewinds;
> #B color 12;
> #P newex 196 253 91 9109513 scale 65535 0 -3. 1.;
> #P flonum 196 279 81 9 0 0 0 139 0 0 0 221 221 221 0 0 0 0 0 0;
> #P comment 783 35 125 9109513 RIGHT DECK;
> #B frgb 57 225 0;
> #P toggle 881 448 15 0;
> #P message 881 473 41 9109513 loop $1;
> #P window linecount 2;
> #P comment 760 390 100 9109513 Right Trigger acts assample start/stop;
> #B color 12;
> #P window linecount 1;
> #P newex 722 389 38 9109513 sel 128;
> #P newex 722 414 38 9109513 sel 0;
> #P newex 822 364 111 9109513 scale 65535 30463 -1. 1.;
> #P message 686 457 30 9109513 stop;
> #P newex 804 493 36 9109513 sig~ 1.;
> #P flonum 793 462 81 9 0 0 0 139 0 0 0 221 221 221 0 0 0 0 0 0;
> #P message 804 428 14 9109513 1;
> #P message 718 457 44 9109513 startloop;
> #P comment 817 428 68 9109513 Speed Control;
> #B color 12;
> #P newex 886 320 76 9109513 route 8 20 54 59;
> #P user led 153 407 17 17 4 150;
> #P user led 153 386 17 17 4 150;
> #P user led 153 365 17 17 4 150;
> #P message 171 365 26 9109513 1.15;
> #P newex 788 230 101 9109513 buffer~ scratch4 2000;
> #B color 15;
> #P message 788 207 42 9109513 replace;
> #P newex 788 182 101 9109513 buffer~ scratch3 2000;
> #B color 15;
> #P message 788 159 42 9109513 replace;
> #P newex 788 134 101 9109513 buffer~ scratch2 2000;
> #B color 15;
> #P message 788 111 42 9109513 replace;
> #P newex 769 686 29 9109513 dac~;
> #P message 973 596 60 9109513 set scratch4;
> #P message 910 596 60 9109513 set scratch3;
> #P message 847 596 60 9109513 set scratch2;
> #P message 784 596 60 9109513 set scratch1;
> #P newex 769 637 76 9109513 groove~ scratch;
> #P newex 788 87 101 9109513 buffer~ scratch1 2000;
> #B color 15;
> #P message 788 64 42 9109513 replace;
> #P button 289 433 15 0;
> #P button 267 433 15 0;
> #P newex 37 311 87 9109513 buffer~ loop4 2000;
> #B color 15;
> #P message 37 288 42 9109513 replace;
> #P newex 37 263 87 9109513 buffer~ loop3 2000;
> #B color 15;
> #P message 37 240 42 9109513 replace;
> #P message 490 553 46 9109513 set loop4;
> #P message 442 553 46 9109513 set loop3;
> #P newex 506 442 28 9109513 sel 0;
> #P newex 474 442 28 9109513 sel 0;
> #P user umenu 535 242 100 9109543 1 64 258 1;
> #X add “USB Joystick “;
> #P number 464 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 420 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 420 277 54 9109513 unpack 0 0;
> #P newex 454 216 36 9109513 print hi;
> #P newex 410 199 27 9109513 hi;
> #P message 446 154 36 9109513 poll 0;
> #P message 485 154 35 9109513 poll 10;
> #P button 453 98 16 0;
> #P message 420 71 31 9109513 menu;
> #P comment 412 37 125 9109513 LEFT DECK;
> #B frgb 57 225 0;
> #P comment 477 68 67 9109513 1. Click Menu;
> #B color 12;
> #P comment 477 85 225 9109513 2. Select USB Joystick from Drop-Down
> Menu;
> #B color 12;
> #P comment 477 102 191 9109513 3. Click ‘Poll 10′ To Send Controller
> Values;
> #B color 12;
> #P comment 561 362 156 9109513 Assigned to Buttons 1-4;
> #B color 12;
> #P user led 481 405 17 17 3 150;
> #P user led 462 405 17 17 2 150;
> #P user led 443 405 17 17 1 150;
> #P user led 424 405 17 17 0 150;
> #P newex 424 362 136 9109513 route 48 49 50 51 53 55 57 0 4;
> #P newex 443 442 28 9109513 sel 0;
> #P newex 410 442 28 9109513 sel 0;
> #P button 246 433 15 0;
> #P button 224 433 15 0;
> #P message 394 553 46 9109513 set loop2;
> #P message 346 553 46 9109513 set loop1;
> #P newex 37 215 87 9109513 buffer~ loop2 2000;
> #B color 15;
> #P message 37 192 42 9109513 replace;
> #P user ezdac~ 50 817 94 850 0;
> #P toggle 233 674 15 0;
> #P message 335 715 41 9109513 set loop;
> #P user waveform~ 346 793 200 74 139 9;
> #W mode select;
> #W mouseoutput continuous;
> #W unit ms;
> #W grid 1000.;
> #W ticks 0;
> #W labels 1;
> #W vlabels 0;
> #W vticks 1;
> #W bpm 120. 4.;
> #W frgb 33 0 0;
> #W brgb 60 178 173;
> #W rgb2 0 95 255;
> #W rgb3 0 0 0;
> #W rgb4 0 0 0;
> #W rgb5 190 137 255;
> #W rgb6 100 100 100;
> #W rgb7 100 100 100;
> #P newex 37 166 87 9109513 buffer~ loop1 2000;
> #B color 15;
> #P newex 61 89 44 9109513 groove~;
> #P newex 61 65 44 9109513 buffer~;
> #P message 37 143 42 9109513 replace;
> #P message 113 587 49 9109513 startloop;
> #P message 116 546 27 9109513 stop;
> #P message 197 671 27 9109513 stop;
> #P message 128 671 65 9109513 startwindow;
> #P message 171 407 26 9109513 0.9;
> #P message 171 386 14 9109513 1;
> #P toggle 332 421 15 0;
> #P message 332 446 41 9109513 loop $1;
> #P flonum 376 609 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 251 704 29 9109513 dac~;
> #P hidden toggle 162 288 15 0;
> #P newex 259 579 27 9109513 sig~;
> #P newex 251 635 261 9109513 groove~ hitme;
> #B color 5;
> #P window linecount 2;
> #P comment 171 335 100 9109513 Speed Control for Loops;
> #B color 12;
> #P connect 14 0 17 0;
> #P connect 22 0 23 0;
> #P connect 54 0 55 0;
> #P connect 56 0 57 0;
> #P hidden connect 30 5 75 0;
> #P hidden connect 30 6 76 0;
> #P hidden connect 30 4 77 0;
> #P hidden connect 75 0 74 0;
> #P hidden connect 30 6 8 0;
> #P hidden connect 76 0 8 0;
> #P hidden connect 77 0 9 0;
> #P connect 30 8 93 0;
> #P fasten 93 0 92 0 201 271 201 271;
> #P fasten 53 0 1 0 495 602 256 602;
> #P fasten 52 0 1 0 447 602 256 602;
> #P fasten 25 0 1 0 399 602 256 602;
> #P fasten 24 0 1 0 351 602 256 602;
> #P connect 2 0 1 0;
> #P hidden fasten 6 0 1 0 337 594 256 594;
> #P hidden fasten 12 0 1 0 121 581 256 581;
> #P hidden fasten 13 0 1 0 118 619 256 619;
> #P connect 1 0 4 0;
> #P fasten 10 0 4 0 133 699 256 699;
> #P fasten 11 0 4 0 202 699 256 699;
> #P connect 20 0 4 0;
> #P fasten 92 0 2 0 201 578 264 578;
> #P hidden fasten 74 0 2 0 176 519 264 519;
> #P hidden fasten 3 0 2 0 167 511 264 511;
> #P hidden fasten 8 0 2 0 176 535 264 535;
> #P hidden fasten 9 0 2 0 176 527 264 527;
> #P connect 1 0 4 1;
> #P connect 7 0 6 0;
> #P fasten 26 0 24 0 229 497 351 497;
> #P fasten 28 0 24 0 415 489 351 489;
> #P fasten 53 0 18 0 495 681 351 681;
> #P fasten 52 0 18 0 447 681 351 681;
> #P fasten 25 0 18 0 399 681 351 681;
> #P fasten 24 0 18 0 351 681 351 681;
> #P connect 19 0 18 0;
> #P connect 18 2 5 0;
> #P connect 5 0 1 1;
> #P fasten 27 0 25 0 251 482 399 482;
> #P fasten 29 0 25 0 448 489 399 489;
> #P fasten 49 1 44 0 630 191 415 191;
> #P fasten 43 0 44 0 451 176 415 176;
> #P fasten 42 0 44 0 490 183 415 183;
> #P fasten 41 0 44 0 458 139 415 139;
> #P fasten 40 0 44 0 425 145 415 145;
> #P connect 31 0 28 0;
> #P fasten 44 0 46 0 415 233 425 233;
> #P fasten 46 0 47 0 425 304 425 304;
> #P fasten 44 0 30 0 415 346 429 346;
> #P fasten 30 0 31 0 429 393 429 393;
> #P fasten 50 0 52 0 479 489 447 489;
> #P fasten 58 0 52 0 272 482 447 482;
> #P fasten 30 1 32 0 446 393 448 393;
> #P connect 32 0 29 0;
> #P fasten 44 0 45 0 415 215 459 215;
> #P fasten 30 2 33 0 463 393 467 393;
> #P connect 46 1 48 0;
> #P connect 33 0 50 0;
> #P fasten 30 3 34 0 480 394 486 394;
> #P fasten 51 0 53 0 511 489 495 489;
> #P fasten 59 0 53 0 294 482 495 482;
> #P connect 34 0 51 0;
> #P fasten 44 1 49 0 432 238 540 238;
> #P connect 86 0 84 0;
> #P connect 87 0 80 0;
> #P fasten 78 2 87 0 925 351 727 351;
> #P fasten 78 2 86 0 925 357 727 357;
> #P fasten 66 0 62 0 978 625 774 625;
> #P fasten 65 0 62 0 915 625 774 625;
> #P fasten 64 0 62 0 852 625 774 625;
> #P fasten 63 0 62 0 789 625 774 625;
> #P fasten 89 0 62 0 886 563 774 563;
> #P fasten 83 0 62 0 809 574 774 574;
> #P fasten 80 0 62 0 723 555 774 555;
> #P fasten 84 0 62 0 691 555 774 555;
> #P connect 62 0 67 0;
> #P connect 99 0 63 0;
> #P connect 60 0 61 0;
> #P connect 68 0 69 0;
> #P connect 70 0 71 0;
> #P connect 72 0 73 0;
> #P connect 62 0 67 1;
> #P fasten 85 0 82 0 827 422 798 422;
> #P fasten 81 0 82 0 809 453 798 453;
> #P fasten 82 0 83 0 798 485 809 485;
> #P fasten 78 0 85 0 891 351 827 351;
> #P connect 90 0 89 0;
> #P fasten 44 0 78 0 415 269 891 269;
> #P connect 103 0 99 0;
> #P connect 100 0 65 0;
> #P connect 101 0 103 0;
> #P connect 96 0 101 0;
> #P connect 95 0 97 0;
> #P connect 97 0 96 0;
> #P connect 104 0 100 0;
> #P connect 78 3 95 0;
> #P connect 102 0 104 0;
> #P connect 96 0 102 0;
> #P connect 97 1 96 1;
> #P connect 95 0 98 0;
> #P connect 98 1 96 2;
> #P pop;
>
>
> Hope somebody will get back to me.
>
> Thanks in advance if you do, I appreciate it.
>
> Jamie.
>
>
http://www.petermcculloch.com

#105881
Jun 11, 2007 at 12:50am

Hello Peter,
I’ve just spent a while trying (in vain) to get to grips with the cartopol object. I’m finding hard to figure out where it is I need to connect the outputs of the x/y thumbstick values to with regards to it. In the help file it shows the rotational effect that I am definately after, but I think (for me) it’s maybe a bit too complicated to grasp with the help file alone. At least at the stage I am currently at.

Any pointers?

Thanks for the reply.

Jamie.

#105882

You must be logged in to reply to this topic.