Notein Octave Changer

orange_glass's icon

Hi I'm making a little patch here to cycle a notes up and down 3 octaves. There is a setting also to state how many notes stay in one octave.

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

It works fine monophonic but when it gets chords it sometimes leaves a note sustained. I'm using it in max for live and in the midi dots after this device I can see a permanent orange dot lit up when it sustains. Anyone know why it's sustaining certain notes in chords?

Roman Thilenius's icon

i have only looked at it, not tried it, but it is probably the cycle.

for realtime note on and note off pairs you can not use cycle that way, because when too many notes appear the outs are already in use again while the note off for the running note isn´t even in sight.

try to use [cycle 24] or give that mechanism up. there are probably 100 ways to reach the same in a different way, for example by multiplying the counter output, or by gates.

-110

broc's icon

You could use a table with 128 entries to store the transposition which was applied to note ons, and then for note offs look up the table to apply the same transposition.

Christopher Dobrian's icon

I see two potential screw cases in your current program.

One is that every note-on will trigger the counter, so every alternate note-on triggers the cycle object and changes the transposition. If you're playing two or more "simultaneous" notes (nothing is truly simultaneous in Max or in MIDI, but let's say two or more notes that occur within a very small amount of time of each other, say within 40 ms or so), this can have the unwanted effect of causing transpositions to occur more often than you want (if you want each chord to trigger the counter only once).

The second problem, related to the first, is that because you're triggering the counter with each note-on, chords can also cause the transposition value to change between a note-on and its corresponding note off. That's the reason for the stuck notes you're experiencing.

Here are two abstractions that might help solve those problems.

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

The first is one I call "newevent", but you can call it whatever you want. You specify a minimum time you want to allow between messages in order for them to be considered a new event. A message will only get through if at least that amount of time has passed since the previously received message. (This is similar to the Max speedlim object, but is subtly different.)

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

The other is an abstraction similar to one that existed in the original Max tutorials. I call it "transpose", but you can call it whatever you want. It keeps track of the transposition that has been applied to each MIDI note-on pitch, and applies that same transposition to its corresponding note-off, even if the transposition value has been changed in the meantime.

Good luck!

Peter McCulloch's icon

To add what Christopher said, you might also check out the "offer" object; it's designed to help you match up values for note-ons and note-offs.

orange_glass's icon

Thanks all for the help on this, I have managed to get it working with Christopher's transpose patch.