Help with triggering samples based on joystick movement and time

K-Tech's icon

Hi guys,

I am stuck on a fairly simple problem as I am new to Max/MSP.

I have a continous analog input, that has two directions, up and down. What I want is to be able to trigger different samples based on how many movements of the joystick in certain directions occur per second. For example, if the range is scaled to -1 (down), 0 (middle) and 1 (top), then if the joystick is moved up once in a second, trigger sample a, if joystick is moved up, back to middle and up again in space of a second trigger sample b, then the same process occurs but with samples c and d for downwards movement.

I'm aware a second may be too short amount of time, but this is just an example time. Also, I can figure out how to implement the analogue input, so if anybody can tell me how to do the rest of the patch i.e. comparing input with time and triggering the samples that would be great.

Thanks in advance for any help,

Kez

Jean-Francois Charles's icon

analogue input? What do you mean?

Looks like your project could be done based on the following objects. Check the related help files and tutorials:
[hi]
[counter]
[timer]
[gate]
[sfplay~] (with preload) (you could also use buffers etc, but if you're a beginner, I would advise sfplay~ for a first version)
[dac~] (no kidding!)

Jean-François.

Axiom-Crux's icon

sounds like streetfighter 2 turbo power moves.

loadmess's icon

Hi!

I think this should give you a point of departure. I hope it helps.
Good luck! Probably there are other ways to dig this out.

Best regards,
dc

Max Patch
Copy patch and select New From Clipboard in Max.

K-Tech's icon

Thanks for the responses everyone, both are very useful!
Great patch dcocharro, definately helpful

Kez