Forums > MaxMSP

Stepwise Motion in Counterpoint Patch?

Sep 19 2010 | 11:37 pm

Hey there!

I’m brand new to Max, and I’m trying to build a counterpoint generator that outputs notes using random stepwise motion, but I’m having a little trouble in one specific area. In the patch I’m including here I’m trying to model stepwise motion in a diatonic scale. My approach was to randomly generate a number that indicates step up or step down and then to modify a stored value to get the next scale step. I have a number that stores scale degree and a number that stores octave. Later on I convert from scale degree to pitch class and then to midi note value, but I can’t seem to get my step function to work.

Signal Flow:

Metro sets a clock for the Random 2 to send a 1 or 0 to a Select. If a 0 was sent, a message goes to the Add to add a -1 to the number box in the middle (current note). If a 1 was sent, a message goes to the Add to add a 1 to the current note. (The 0 button is simply a reset for testing purposes) If the current note number box reaches a -1 (ti below do) the number is supposed to be reset to 6, and the current octave should be decremented. If the current note number box reaches a 7, the number is supposed to be reset to 0, and the octave should be incremented. It’s sort of working, but after a while the current note number box starts behaving bizarrely and I can’t tell why…

Surely this function is possible in max — can anyone show me the ‘max’ way to do this?

-- Pasted Max Patch, click to expand. --

Sep 20 2010 | 12:50 am

Here is a quick example of how this could be done.
the incoming note is converted to pitch class (so we can check if it is part of the C major scale), the offset is added (+2 or -2, whole steps). Check if the resulting note is in the C major scale, if not change it so it is…

I don’t like the use of the [if] statement. I usually try to avoid them like the plague. But it seemed the quickest way of achieving this.

-- Pasted Max Patch, click to expand. --

Sep 20 2010 | 3:14 am

I haven’t looked at your patch, but I have a borderline elaborate note quantizer, called ScaleMaster, available on my max page: It has several methods of bringing a number into conformation to a given scale. It may prove useful in this case.

Sep 20 2010 | 3:31 am

Thanks for the replies :D

MIB: Thats not quite what I was going for. The idea is to basically build an automaton that walks up and down the scale, synchronized to the clock. The random element is that the NEXT note generated will be randomly one step below or above the the current note… Its really like a finite state machine if that helps… Don’t really know how to do stuff like that in max though.

edit: Oh, I just realized what was throwing you off. The idea is that I’d have two of these such automatons running in parallel, and thus generate counterpoint. Ha ha I guess without explaining that it didn’t make much sense that I called it a counterpoint generator.

Chris: Wow, thats completely awesome! I am book marking your page, and in the next stage of the counterpoint machine ScaleMaster will be incredibly useful!
I just need help getting to that step…

If I’ve been unclear in my explanation of what I’m trying to do, just let me know and I’ll clarify. Again, thanks so much for your replies!

Sep 20 2010 | 5:28 am

I think your looking for drunk…

-- Pasted Max Patch, click to expand. --

Sep 26 2010 | 9:07 pm

I would say to keep all your scale degrees in a list and then just step up and down by 1 *index* each time (or more for skips). The list (which you can make with matrixctrl) would ensure that only scale notes are chosen.

major scale would be
0 2 4 5 7 9 11
0 2 3 5 7 8 10

so, the movement would just run up and down the lists.

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

Forums > MaxMSP