Forums > MaxMSP

[pitch] object for Max

April 4, 2012 | 7:02 pm

Hi Guys,

First post, long time Pd user. Using Max for some teaching. I created an abstraction based on the [pitch] object available in Pd by Olaf Matthes, which organises incoming MIDI note numbers into pitch-class, pitch-class distance and register. So, I thought I’d share:

http://rickygraham.com/pitch-abstraction-for-max

Rather than using the two [if] statements, I would like to know how to program this function in one [expr]-based statement.

Cheers,

Ricky

Attachments:
  1. pitch.maxhelp

April 4, 2012 | 7:16 pm

with expr: [expr min(max($i1,127),0)]

with clip: [clip 0 127]

choose one.

i have chosen -110.


April 4, 2012 | 7:18 pm

weird. in the above post i first forgot the commas in the formula – after sending it to the forum the zero had vanished – the forum does not like "backslash 0"


April 4, 2012 | 7:25 pm

send "$0" must read "send #0" in max or you cant instantiate the abstraction.


April 4, 2012 | 10:08 pm

Good to know. Thanks Roman. I have updated the patch. So, [expr] cannot take an [if] statement in Max? and [if] cannot take multiple/nested instances?

Best,

Ricky


April 5, 2012 | 9:01 am

Hi Ricky and welcome to the forum

Sometimes we WANT our objects to do stuff, which they won’t and it’s frustrating to have Max tell you "sorry, won’t work dood"; in my experience the [if] object can only have ‘binary’ output

if apples or bananas then pig else goat

but not

if apples then pigs, elseif bananas then goats.

I’m almost 99.9% sure [if] in Max doesn’t do elseif.

But an [expr] ninja will surface soon with a solution; Roman’s [clip] is simplest.

Brendan


April 5, 2012 | 2:36 pm

Cheers, good sir. Yes, I have gathered all of the points above through "enactive research." Actually, using min and max within inspector is the easiest solution for that particular statement, but I would like to get [expr] working beyond what I have already implemented (if possible).

I should add, when I enter a backslash into an [expr] object in Max 6, it disappears completely (much like like Roman’s issue with this forum).

Nice to meet your virtual Max-based acquaintance. Coffee soon?

R


April 5, 2012 | 6:48 pm

Try [zmap 0 127 0 127] too;

QUB coffee on Monday perhaps


April 6, 2012 | 7:21 pm

Sure. I will drop you a mail.

R


April 7, 2012 | 1:26 am

"So, [expr] cannot take an [if] statement in Max? and [if] cannot take multiple/nested instances?"

exactly.

there is absolutely no if in [expr] (dont tell me there is one in pd!) and you cannot have nested outputs with [if].

the only thing what works is using multiple conditions on the input of if:

[if $i1>100 && ($i1+5)%12>$i2 then bang]

what you of course can do in expr is using boolean/comparison operators to sum up conditions.

so instead of

[expr min(max($i1,127),0)]

you could write

[expr ($i1>=0) && ($i1< =127)] … and control a [gate] with it.

-110


April 7, 2012 | 3:20 pm

"(dont tell me there is one in pd!) "

Yes, there is! :)

Thanks for the clarification, Roman.

Ricky


April 7, 2012 | 4:36 pm

so i learned something new about PD, thats fine. i wish there would be some kind of expr overview or tutorial, i have gathered everything by trial error and sometimes i think i still miss something.

btw, using min and max to the numberbox is the worst you can do. GUI objects have nothing to do inside abstractions, they need to much CPU.


April 7, 2012 | 5:03 pm

Yep, sure. GUI objects are expensive no matter what the environment. I said it was the easiest solution, not the best solution ;) Thanks again for your clarification.


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