Forums > MaxMSP

Using scale to round off values into note frequencies.

November 19, 2012 | 7:26 pm

Hi, I wonder if anyone can give me some pointers.

I’m trying to take numerical values between 80 and 180 and convert them to frequency values of a c major scale, eg if the value 80 is input the note C 261.63hz is generated, 81 = D 293.66, 82 = E 329.63

Any help most appreciated.


November 19, 2012 | 7:35 pm

Hi
[coll] is really the only way to do this with minimum fuss, although [itable] or maybe [multislider] could help toi

Brendan


November 20, 2012 | 5:46 am

[expr (($i1-79)*12)/7+59)] -> [mtof]

Integrating the MIDI-to-frequency conversion into the expr object is left as an exercise for the reader.

The basic technique is to use *integer* arithmetic. Multiplication with 12 followed by division with 7 maps sequential integers to a diatonic pattern (half step/step/step/half step/step/step/step). The rest is just figuring out offsets to get the mode and tonic you want.


November 20, 2012 | 7:59 am

Leaving aside the fact that there aren’t 100 values of C Major, essentially you are trying to use integers as scale degrees.

I would tackle this as two parts: convert the integers into MIDI note numbers in the scale of your choosing. Then, use mtof or mtof~ to convert to frequency.

FWIW, I have a scale degree quantizer in my Scale Master total-overkill quantizer system, which can be found here: http://www.xfade.com/max/


November 20, 2012 | 10:22 am

Ah, Chris, it’s only fourteen octaves. Maybe astevens wants his dog to enjoy the music, too!

Nice collection of scales.


November 21, 2012 | 9:22 pm

Thanks for all the tips, yes you’re right, there aren’t 100 values of the scale.

What a pickle eh…

Thanks again for your time chaps.


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