Octave folding

Anthony Nolan's icon

Is there an existing midi effect that will "fold" incoming midi to a limited number of octaves?

For example if the range is set to octave 1 and I send midi notes C1, C2, C3, C4 it would output C1, C1, C1, C1

The idea here is to be able to have a single midi sequence, either defined or generative, duplicated to an ensemble of instruments where the notes each instrument plays compliment a desired range for their tonal quality. It would be great if I have a midi sequence that ranges six octaves but I want the 808 or bass instrument to only play within a lower octave or two.

schlam's icon

hello
here is a simple way to do that with live stock devices.
it's just a midi rack with a "key" chains per octave input and pitch devices accordingly setup..

Just change the pitch param of all the "pitch" devices if you want to reach another octave that C1

And here on maxforlive.com, there is a device which seems to do the trick
https://maxforlive.com/library/device/3452/midi-one-octave-fold

ALL_OCT_TO_C1.adg
adg 3.36 KB

florian1947's icon

or in vanilla Max, easy to convert to M4L

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

Anthony Nolan's icon

Oh wow, you're totally right, I don't even need Max for this. Thanks guys! I couldn't get that ADG file to open but I was able to put this together which seems to work.

OctaveFold_noni.adg
adg 35.87 KB

Is there a more efficient way of doing this or have you helped me figure this out properly?

Thanks again!

drum throwaway's icon

Just to make sure we're on the same page - Schlam recommended using a rack with instruments set to different keyzones with all the instruments having their transpositions appropriate to get the correct folding?

It's kind of a messy way of doing things IF you want your MIDI data to be the octave folded MIDI data. It also requires you to use transpositions on the instruments which may not be wanted. Because what you get is data spread across the different multi-octave keyzone ranges instead of folded data like I mentioned would possibly be the goal.

double_UG's icon

Note Range Wrap 01.amxd
application/octet-stream 28.24 KB

nicnut's icon

I didn't look at your patches, but to constrain notes within a range of an octave I usually use the modulo object set to 12 : [% 12] connected to a plus object for whatever octave I want the notes to be in, like [+ 24] for two octaves up.

or you can use the [split] object and specify the exact range of notes you want and ignore the rest. Either of these methods is super simple to implement.

tyler mazaika's icon

Just to chime in on this subject... I think it's important to program in solutions in any device which does something like this to deal with collisions of notes. Say you have a held note, N(1), inside your folded range. Then another note, N(2), arrives and gets folded onto the same note. Do you want it cutting off the previously held notes? Do you want to ignore the new note-on? A note off for either N(1) or N(2) would stop "both", and is that something you really want? Only mentioning this because I've come across synths / effects that happily allocate repeated note-ons for the same pitch, but then the note-offs don't get mapped the same and the result is potential for stuck notes.

florian1947's icon

You could avoid that by sending 'all notes off' just before any change of mapping (this will likely hide the cutting of held notes) .
What puzzles me still, is how to map two octaves, as OP posted, and not just one. In addition to the modulo thing, you'd have to determine who gets mapped into which target octave (assuming the input pitches are all over the range).

drum throwaway's icon

A note off for either N(1) or N(2) would stop "both", and is that something you really want?

I assume most wouldn't. I think most would want the last note off of the duplicate note to stop the sustaining.

You could avoid that by sending 'all notes off' just before any change of mapping (this will likely hide the cutting of held notes) .

Am I missing something obvious or does this not allow for polyphonic playing?

The only reason I'm adding more comments is because I've tried to get this working myself and gave up on it. My use case was trying to get two keyboards to work on the same range of notes together - not exactly an octave folding but this scenario has the same desire for "last-off" note-off behavior.

Source Audio's icon

This can be done easily if one knows exactly what to do with repeated notes.
But as this is not the case here it makes no sense at all to offer any kind of solution.

Best one can do Tyler allready did - point out the problems one has to deal with.
Sending all notes off before changing any mappings is a good idea,
but has nothing to do with notes folding and dealing with repeated notes.

@ Drums Throwaway - a pitty that you gave up with that 2 keyboards setup.
If you count current held notes of same pitch,
you could countdown note offs to do what you wanted - wait for last note off.

Dino Spiluttini's icon

Reviving this old thread for my own question.

Can anyone help me make a max for live device that takes an incoming stream of midi notes and folds them down to only a certain number of notes?

For example, I'm getting a sequence of 12 different notes from any given sequencer, but I want to convert them all into C-1 notes. Or C-1 up to E-1, in a random or somehow assignable distribution.

I've done my research on this a lot in the last few days, and it's insane that there isn't such a device already. I didn't even find pointers on how to code this (I'm p much a noob).
This can't be that hard, right?

Any input (no pun intended) is greatly appreciated!

Roman Thilenius's icon

only C-1:
[t 24]

random between C-1 and E-1:
[random 5]
[+ 24]

Dino Spiluttini's icon

thank you I'll look into that!

Marc Assenmacher's icon

The scale plugin from fingerspushbuttons has a pretty neat implemented. As a little plus you have three different blending modes: Block, Play in Range and Pass uneffected.
https://maxforlive.com/library/device/9375/fpb-pitch-scaler-plus

The Patches are pretty messy, but I made a cleaned up version for myself that I attached below. I could potentially get a little messy again, since I am using the Ableton Font in my patches and you probably won't have this one installed on you computer.

All props for the code goes to fingerspushbuttons though!

MM-OutOfRange.maxpat
Max Patch

MM-Scale.maxpat
Max Patch