expr pow(2.,($f1/12.)) Octave calculation issues

johno's icon

johno

10月 17 2024 | 8:17 午後

Hi Folks,

I'm trying to calculate semitone values in a scale from a specific frequency value using

[expr pow(2.,($f1/12.))]

and add them to a [coll].

It generally works fine, but

when it calculates octaves it seems to truncate the numbers after the decimal point. I have checked the output of the expr object and it is multiplying by 2. (rather than 2) and it is being given a float in the first place.

Has anyone got any ideas on why this is and how to fix it. Otherwise my octaves will be slightly flat each time.

thanks in advance,

John

expr_semitone_example.maxpat
Max Patch
Roman Thilenius's icon

Roman Thilenius

10月 17 2024 | 11:01 午後

the patch doesnt work for me, but could swear i see a [t b i b] at the top.

Wil's icon

Wil

10月 18 2024 | 12:40 午前

that [t b i b] must be very special!

I received this automated reply this morning to my recent post here

but the actual reply is this post

***hope you feel better


Wil's icon

Wil

10月 18 2024 | 12:50 午前

JOHNO it works fine try this

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


Roman Thilenius's icon

Roman Thilenius

10月 18 2024 | 2:51 午前

yeah it is superspecial, it can transform 261.626 into 261 even if you did not want this.

johno's icon

johno

10月 18 2024 | 9:38 午前

@Roman Thilenius

Doh!! I didn't spot that one. I had been scratching my head about this for quite a few hours. I think that is the only place I didn't fully investigate! It all works now. Thanks.

@Wil

Thanks for the alternative patch. I dig into that one and check your approach. Thanks!!