[pitch] object for Max

Apr 4, 2012 at 7:02pm

[pitch] object for Max

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
#62768
Apr 4, 2012 at 7:16pm

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

with clip: [clip 0 127]

choose one.

i have chosen -110.

#226611
Apr 4, 2012 at 7:18pm

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″

#226612
Apr 4, 2012 at 7:25pm

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

#226613
Apr 4, 2012 at 10:08pm

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

#226614
Apr 5, 2012 at 9:01am

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

#226615
Apr 5, 2012 at 2:36pm

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

#226616
Apr 5, 2012 at 6:48pm

Try [zmap 0 127 0 127] too;

QUB coffee on Monday perhaps

#226617
Apr 6, 2012 at 7:21pm

Sure. I will drop you a mail.

R

#226618
Apr 7, 2012 at 1:26am

“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

#226619
Apr 7, 2012 at 3:20pm

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

Yes, there is! :)

Thanks for the clarification, Roman.

Ricky

#226620
Apr 7, 2012 at 4:36pm

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.

#226621
Apr 7, 2012 at 5:03pm

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.

#226622

You must be logged in to reply to this topic.