[expr] object: represent fractions, not decimals

c. r.'s icon

hello,

is there any way the [expr] object represents fractions? like if i said i wanted [expr $i1/4] and $i1 would be 1, the output would be: 1/4. it always comes out as either 0 or, if i put $f1 (instead of $i1), as decimal.

c.

c. r.'s icon

(strangely enough, i can't see your reply, i'll answer anyway.)

thanks for your answer. i've tried it but the output wouldn't show as fractions, so i think i might not have been very clear in my formulation. i don't mean to put them as an input but get them out as an output. it's for musical durations in the "bach extension", therefore i need fractions as an output. is there any way to do that?

slo ~|•'s icon

CR

I deleted my response because I realized I wasn't answering the question you were asking. That's why it is not on the forum anymore.

I'm not familiar with the bach package, so I can't answer your question specifically. I'm not sure what exactly the bach object(s) are expecting.

I can say that [expr] is a maths object solving an equation, so the / is a division operator, and 1 / 4 results in 0.25.

If you want to creat a symbol the such as "1/4" then you could use the [combine] object, as in this example:

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

(Sorry if this is too pedantic sounding)

c. r.'s icon

oh, i see! that makes sense!

thank you so much, this is a great and very promising answer!

all best,

c.

andrea agostini's icon

Hi,
with bach you can do all sorts of operations on rational numbers:

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

Hope this helps,
aa

c. r.'s icon

hi andrea,

i wasn't aware that you can output sort of any bach operation as a text via the "@out t" attribute. that was a very helpful piece of information, indeed!

thanks,
all best,

c.