I think I understand what you need, but I'm not aware of anything that will do this.
Firstly, are you looking for something that will modify the midi data while it's being played, or do you expect to modify a midi file into a new file, so you end up with the changed midi data.
As I understand it, you want to sort of compress all the midi data into one octave, an octave specified by you (will all changes be into the same octave?). So any notes that are already in the target octave will be unchanged, all notes that are outside the range will be changed (by octave ONLY) so that they are inside the required range. The midi note number is therefore changed by plus or minus 12 per octave?
If it was me, I'd just write a prog to do this. Rather, modify an existing prog that processes a midi file. I don't think there will be anything that actually does this, as it doesn't really make any sense MUSICALLY.
A prog would be easier if you merely change the data into a new file. So data is read byte by byte from one file, and written to a new file. All Note ON and Note OFF data is changed to retain, or change, the octave as required, before being written to the new file. Such a prog doesn't need to have much understanding of the midi data, merely spot the Note On/Off events. A prog to actually PLAY the data will need to interpret a LOT more. The convert prog could also report on notes changed, so it might tell you how many notes were above the range, how many below, and hence how many had been moved, or however much detail you needed.
Geoff