Forums > MaxMSP

MIDI note numbers in different scales

Jul 02 2009 | 3:29 pm

this is my firts post here. I tried to find the answer first but not succesful yet.
Please does anyone know some simple way how to filter the random chaotic data stream, that only number that fits to the chosen scale passed through the filter? Is there somewhere some table with note numbers for every scale possible? [ C dur, C moll, D dur, D moll, and also harmonic, aiol, pentatonic etc variants…]
I have IR senzor and I want to use it for "normal" musical playing. The linear data stream is useless.
Thanks a lot.

Jul 02 2009 | 4:18 pm


I would do a quick look at to see if there is an obvious object that does what you want. But really, you could just make this with a few max objects. I’m assuming you are getting MIDI note numbers. I would:

– Divide by 12 to get the octave
– Compare the remainder (%12) to a table of a scale (C dur is 0 2 4 5 7 9 11). Select might be your friend here, or coll. Only let through the numbers that fit your scale
– multiply by the octave to get back in the right register

That’s it.

Good luck.


PS If that doesn’t make sense, ask for an example.

Jul 02 2009 | 6:46 pm

Thanks.Yes thats good idea. Maybe I didnt say the question corectly – I am looking for the table of midi notes numbers for all scales (not just C dur). Of course I can do it manually, but I am very lazy for this. I would like to make some patch that should filter the input data into all scales possible.

Jul 02 2009 | 7:39 pm

The good thing about scales is that they repeat identically in every octave. Moreover, in terms of midi, a different scale could simply be considered an offset. What you need to do is build an abstraction around these considerations and you’ll be able to play piano.

For the record, chaos and random are completely different things, and both don’t describe well what comes from your sensor.


Jul 03 2009 | 8:01 am

The word scale has already been taken by a vanille max object. Don’t add too much béchamel confusion to this already distressed world.


Jul 03 2009 | 11:49 am

anyway I worked on it before I´ve read this posts.
Here is the result.
You can choose 5 types of scales, and choose the base tone.
Of course you can experiment with some alternative scale numbers.
(done with Max 4.5.5).
I realize it is not so difficult as I thought before…

Jul 03 2009 | 9:07 pm
jvkr wrote on Thu, 02 July 2009 21:39
The good thing about scales is that they repeat identically in every octave… and you’ll be able to play piano.

No, it doesn’t happen to me when I’m playing (MIDI-fied) violin or fretless guitar.

Jul 05 2009 | 7:25 am

Of course, but its question of tuning the scale. (like natural, temperated…). But the note numbers are repeating always the same.
The problem is how to transform notes into frequency – there is more than one way… And when you play violin you must do it by your hands and you see whats happening in higher octaves. Thaths the synoptic comma. (sorry if I dont translate it well – I know these words only in the czech language- and specially in musical terminology sometimes the translation difference are very big).

Jul 05 2009 | 11:25 pm

If you’re after just intonation then search maxobjects for [justy]. You could also just store frequency values in a [coll].


Jul 06 2009 | 12:06 am

lets organize some structure in this chaos discussion.

he has a physical controller, which is most
likely proving a linear range, for example
from 0 to 100 or from -1. to 1.

he wants an output of, for example, a major or
minor scale.

this requires two steps, changing the range and remapping
the linear behavior to a scale of certain ints (or floats
for exotic scales).

the first step could be, for example, [zmap -1. 1. 24. 96.]
in order to get a range of six octaves.

the second step is far more interesting:
how do you get a C minor list of ints out of a linear range?

one of many different answers can be "leave it linear but
remove the notes not needed."

24 25 26 27 28 29 30 31 32 33 34 35 36 will remain
24 25 26 27 28 29 30 31 32 33 34 35 36 but
25, 27, 30, 32, and 34 will not be played,
they are filtered out by something using route, gate,
and modulo before the data goes to the synth.

another option is to remap the whole thing from
24 25 26 27 28 29 30 31 32 33 34 35 36 to the desired scale of
24 26 28 29 31 33 35 (36 38 40 41 43 45) in order to have a
Cmajor scale which reacts linear to the joystick input.

this could be done with coll, but a more speed optimised
code would be welcome if someone suggests it.

i once made myself a "white notes to all keys" converter:
it takes only whites keys from a keyboard controller and
maps them to 0-127 (or actually less then 127…) in
chromatic steps. (nice for playing drums from a sampler)


Jul 07 2009 | 5:28 pm

Roman: thanks for qualify response. But as I wrote I´ve solved this probelm already and I post the finished patch that works fine.
Its with 2 major 2 minor and one exotic scale with any base note. So there is plenty of possible scales and its easy to write your new special scale that you want to filter from the input data.
If you are interested look at the patch.

With tuning I react on PhiDjee who mixed together two musically different thing – the scales it selfs (what means definitions of intervals between the notes on each step – this is easilly converable into MIDI notes), and the tuning of the notes.This means what exact frequency means C1 and what freq. is C7. This is far complex question… But we usualy use equal temperamen and dont solve the other posibilities… But this is NOT the question of this thread so forget about it…

Feb 16 2015 | 7:51 am

Hello, where could I get your patch ? It is what i am looking for :)

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

Forums > MaxMSP