Forums > MaxMSP

Need help please

December 28, 2013 | 6:16 am

Hello everyone!

I’m new to max msp and have a little question. I’m doing a little experiment with a wii remote to make a air drumkit. I’ve managed to get some data out of it with OSCulator. And I’ve also managed to get an actual sound out of it when I use the accelerator from the wiimote. But now I’m willing to do two things.

1. When I get an output of 0.1 I want to get a hi hat sound. That is no problem. But when the output is 0.2 I want to have a differend sound and not the hi hat sound. The problem is that I dont know how to write this in Max. It has to be a kind of if else function but I’m not sure how to do this.

2. An other solution that would be even better is to change the sound when I press (for example) the "A" button of my wiimote. So when I have it unpressed, it wil make sound1 when I move with it. And when I press the A button it wil produce sound2 when i move with it. Notice that I dont want to make a sound when the A button is pushed. I want to trigger the sound the same way as sound1 but by pressing the "A" button it simply has to switch to another sound when moving.

I’m sorry if this is kind of confusing.

This is the code I have so far.

<code>

– Pasted Max Patch, click to expand. –

</code>

I would really appreciate some more info. I really want to take my maxmsp skills to the next level.

Thanks a lot!


December 28, 2013 | 9:07 am

Hi
I didn’t look at your patch, because you describe the problem quite clearly, so it’s easier to solve. You describe four "conditions": if greater than 0.1 true or false, and if A is pressed true or false. Some Maxers might use the [expr] object, I prefer the visual approach to logic, so I use [gate] and [split]. Oh, and [togedge] is often useful in these scenarios too:

<code>

– Pasted Max Patch, click to expand. –

</code>

HTH

Brendan


December 28, 2013 | 9:29 am

OK
I looked at your patch, and it reveals something we overlooked: you’re using velocity values, which will make things a little more complex when programming discrete thresholds. I’ll get back to you in a while . . . .


December 29, 2013 | 3:40 am

Thanks a lot for your help so far!

I’m looking forward for your help! :D


December 29, 2013 | 7:10 am

It is easy to set up a logic function that does the following:

if velocity is between 0. and 0.1 then trigger sound-A
if velocity is between 0.1 and 0.2 then trigger sound-B

However, you will always trigger sound-A, because you will always pass 0.1 on the way to 0.2. And this is not what you seek I think.

Using a modifier switch as you suggest is a better (easier) solution:

<code>

– Pasted Max Patch, click to expand. –

</code>

Brendan


December 29, 2013 | 7:18 am

An alternative method, which I use a lot for assessing quasi-instantaneous velocity, is the following: delay the [togedge] bang, and use it to trigger a float or int box. It introduces some latency, but you can balance sensitivity and latency by changing the ramp time ([pack f 50]), and the delay value.

<code>

– Pasted Max Patch, click to expand. –

</code>

Brendan


December 31, 2013 | 4:17 am

Thank you very much! This was exacly what I needed!

I have only 1 question about the patch with the A button pressed.
As the patch is now I have to click the A button so it switches to a diffend sound. But to make it perfect I want it to switch sounds when the button is pressed (pushed down) and that it goes back to the original sound when the button is unpressed (pushed up).

Is that possible?

Thanks! :D


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